Skip to main content

Is there a publish/subscribe event for column sort in a dojo.table?

2 replies [Last post]
dwhite
Offline
Joined: 2008-06-16
Points: 0

Hi,
Does anyone know if there is a jmaki event to notify when a column has been sorted in a dojo.table?

If not - is there any other way I could hook some code into the clicking of a column header?

Just in case you're windering why I need this - I have a paged table (loads 10 records per page), so a column header sort works fine for the current page but I'd like to apply the sort to the whole data set i.e. re-query the data with the appropriate sort order when the user selects a column.

Thanks in advance for any thoughts

David

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gmurray71
Offline
Joined: 2003-07-31
Points: 0

Hi,

There is currently not but I just added it to both the dojo table and dojo.table.

The code need is here:

djd43.event.connect("after", table, "onSort", function(){
jmaki.publish(topic + "/onSort", { widgetId : wargs.uuid, value : table.sortInformation[0] });
});

Add this around line 313 after:

djd43.event.connect(table, "onSelect", _widget, "onSelect");

Let me know if this doesn't work.

To create a handler for this simply do the following in your glue.js

jmaki.subscribe("/dojo/table/onFilter", function(event) {
// show the payload
alert("event is " + jmaki.inspect(event.value));
});

dwhite
Offline
Joined: 2008-06-16
Points: 0

Excellent - That worked perfectly.

Thank you very much!