how to select a row in a grid which visualizes xml data
Hi all,
I visualisze XML data (AW.XML.Table) via grid (UI.Grid), but I cannot select a row via javascript:
myGrid.setSelectedRows([0]);
has no effect.
But I can select a row when I use an array as data container instead of xml data.
So, is there another command beside 'setSelectedRows' you have to use when you have xml data as cell data?
Cheers, Michael
Michael
September 12,
No, it should work exactly the same way regardless of the data source.
Alex (ActiveWidgets)
September 13,
Hi Alex,
sorry, but it does not work as you said.
Try this one:
script>
var tablesrc = new AW.XML.Table;
tablesrc.setURL("test.xml");
tablesrc.setAsync(false);
var obj = new AW.UI.Grid;
obj.setColumnCount(2);
obj.setCellModel(tablesrc);
tablesrc.request();
obj.setSelectedRows([0,1]);
document.write(obj);
</script>
No row gets selected.
The only result you achieve by using 'setSelectedRows': the first row disappeares. That means, there is a new blank row instead of the first data row.
the xml file to use:
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<node>
<node_ID>3</node_ID>
<node_NAME>name 1</node_NAME>
</node>
<node>
<node_ID>1</node_ID>
<node_NAME>name 2</node_NAME>
</node>
<node>
<node_ID>2</node_ID>
<node_NAME>name 3</node_NAME>
</node>
</root>
Cheers, Michael
Michael
September 14,
You must change the selection-mode to single-row to get the selection visible.
obj.setSelectionMode("single-row");
I don't know why all rows before the current row disappears but you can prevent this by setting the current row to -1.
obj.setCurrentRow(-1);
heis
September 14,