:: Forum >>

Setting sort order in grid - doesn't stay

I am trying to manually set the default sort order of a grid using the following example:

gridname.sort(2, "ascending");

No matter where I put this in my code the best I can manage is that the sort order (ie. the arrow in the column header) is displayed for a second until the data is loaded then the arrow disappears and the natural sort order is used.

I assumed the proper place to put the sort order code is after the data is loaded and the grid is refreshed but it is not working.

Any ideas? Thanks!
John
Tuesday, May 6, 2008
When the data is loaded the previous sort order is cleared, so you have to apply the sort after loading the data.
Alex (ActiveWidgets)
Friday, May 9, 2008
Below is the relevant parts of the page. I have tried putting the sort order line everywhere I can think of in the page but it always changes back to no sort order as soon as the data reloads. Is it something to do with AJAX?

<script type="text/javascript">
<!--
$(document).ready(function(){
datagrid_load()
})

function datagrid_load(){
var data = new AW.XML.Table;
data.setURL(url here);
data.request();
obj.clearCellModel()
obj.setCellModel(data)
}

function datagrid_create(){
obj.setSize(857, 500);
obj.setSelectionMode("single-row")
var columns = ["Order ID", "Order Status"];
obj.setHeaderText(columns)
obj.setColumnCount(columns.length)
obj.setColumnIndices([0,1]);
return obj
}
-->
</script>

<div id="datagrid">
<script type="text/javascript">
var obj = new AW.UI.Grid
document.write(datagrid_create())
</script>
</div>
John
Friday, May 16, 2008

This topic is archived.


Back to support forum

Forum search