2

I know how to create a sortable table using

theme('table', $headers, $rows) 

but is it possible to create a functionality so that a content creator can create a sortable table inside a content. For example creating a sortable table inside a node.

  • Where is the data coming from? – mpdonadio May 1 '14 at 2:51
  • I guess you should look for a javascript solution – Aboodred1 May 1 '14 at 2:52
  • Data will be entered by user while creating a node. – user11 May 1 '14 at 2:52
  • Is there any javascript solution provided by drupal ? I mean something that I can use from existing code base or should I consider using 3rd party library ? – user11 May 1 '14 at 2:54
  • 2
    I'm not aware of any Drupal module that will do what you're looking for. Take a look at this library tablesorter.com/docs/#Demo is this what your looking for? – Aboodred1 May 1 '14 at 2:58
2

You can use TableField module to create table that is a real html table. Sorting is currently unsupported, sadly, although it would be wonderful.

If all you need is sorting on display, you can create a patch or your own module, and implement one of the jQuery plugins for sorting. Personally I found tablesorter to work pretty OK.

  • A patch to add tablesorter to the display options via Libraries would be pretty easy. Probably an hour or two. Though if the output is run through theme_table(), you would just need to wire up the $sort option. That would also be fairly easy (I think). – mpdonadio May 1 '14 at 14:34
0

see drupal_add_dragtable()

Assists in adding the tableDrag JavaScript behavior to a themed table.

Draggable tables should be used wherever an outline or list of sortable items needs to be arranged by an end-user. Draggable tables are very flexible and can manipulate the value of form elements placed within individual columns.

  • I have resolved this issue by creating a custom module using tablesorter javascript library. – user11 May 5 '14 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.