Question

I want to be able to get the data and sort it in-memory. I am able to get JSON data using dojox.data.JsonRestStore. Now my question is how do I store it in memory and do in-memry sorting when I click on Dojo Datagrid headers. From what I have searched so far, it is not possible to sort the datagrid in-memory/client-side as it will request the sorted data from my Rest Service. As it is custom rest service, I am not able to sort the data on server side (or is it possible?).

Thanks in advance. Arun

Was it helpful?

Solution

Outside of XPages, you should be able to set an attribute of the grid to do this -- clientSort: true

However, this doesn't seem to take effect within XPages. I tried the following, with no success:

  • Adding a clientSort attribute with a value of true to the grid control (via the Dojo tab). The attribute showed up in the right place in the page source, but had no effect. (Programmatically checking the property returned a value of undefined.

  • Setting [grid].clientSort = true on the onClientLoad event of the page. When checked programmatically, the property would show that it is now set to true, but it had no effect.

  • I even tried adding it to a grid created programmatically (without the Dojo Data Grid control) and it had no effect.

It appears that either XPages is wiping out the attribute or that it just doesn't work within XPages with a remote data source. (My first two attempts used a REST service. My third attempt used a remote XML data source.)

I still think it's worth attempting to see whether it works with a local data source (like a read-write item store), but I have not had a chance to try that yet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top