Skip to main content

sorting yahoo datatable

1 reply [Last post]
nnxcoder
Offline
Joined: 2008-02-02

Hi there,
I want to call the servlet using doAjax when I click on the column title instead of the default sorting provided by jmaki. Is there any way to do this?

Thanks,
--Narasimha

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

Right now we don't have a way to expose this in a generic way when it comes to sorting.

It could be done with a little work in the /yahoo/dataTable/component.js where you could add an doAjax call from the sorting .

The code you can look at is around line 90:

// sort function for the providing assending sort for adding items.
function gSorter(a, b, desc) {
var comp = YAHOO.util.Sort.compare;
var myComp = comp(a.getData(cols[0].key), b.getData(cols[0].key), false);

return myComp;
}

where you would would pre-make a call and then base sorting on the results.

Hope this heps,

-Greg