Refresh xml data maintaining grid state
I have seen several threads on this topic, but none of the solutions I have seen have solved my issue, or perhaps I have not implemented the suggested solutions correctly.
I am using a grid whose data comes from an xml file and am trying to implement a refresh method which will reload the data while keeping the currently selected record, scrollbar positions and sort options.
What I have found is this:
- Using grid.refresh() keeps the selected record, scrollbar positions and sort options, but does not reload the data therefore the grid does not reflect changes to the data.
- Using table.request() reloads the data and correctly reflects changes to the data, but resets the grid state losing the selected record, scrollbar positions and sort options.
I tried Alex's old solution offered in this thread http://www.activewidgets.com/javascript.forum.839.4/calling-refresh-when-scrolled-down.html
but I likely didn't implement it correctly since it did not solve the issue either.
What is the preferred method to refresh the data in a grid loaded from an xml file while not losing the current state of the grid?
Below are simplified snippets of my code:
var table = new AW.XML.Table;
var grid = new AW.UI.Grid;
table.setURL("server_xml.asp");
table.request();
grid.setCellModel(table);
function refreshData()
{
// This refreshes data but resets grid state
table.request();
// This maintains grid state, but does not refresh data
grid.refresh();
}
I am using a grid whose data comes from an xml file and am trying to implement a refresh method which will reload the data while keeping the currently selected record, scrollbar positions and sort options.
What I have found is this:
- Using grid.refresh() keeps the selected record, scrollbar positions and sort options, but does not reload the data therefore the grid does not reflect changes to the data.
- Using table.request() reloads the data and correctly reflects changes to the data, but resets the grid state losing the selected record, scrollbar positions and sort options.
I tried Alex's old solution offered in this thread http://www.activewidgets.com/javascript.forum.839.4/calling-refresh-when-scrolled-down.html
but I likely didn't implement it correctly since it did not solve the issue either.
What is the preferred method to refresh the data in a grid loaded from an xml file while not losing the current state of the grid?
Below are simplified snippets of my code:
var table = new AW.XML.Table;
var grid = new AW.UI.Grid;
table.setURL("server_xml.asp");
table.request();
grid.setCellModel(table);
function refreshData()
{
// This refreshes data but resets grid state
table.request();
// This maintains grid state, but does not refresh data
grid.refresh();
}
David
May 14,