3.2.0

Problem with .setrows in Grid V1

I am trying to display two grids on one webpage. So, I have a data island that contains my XML:
<root>
  <row AccountID="2" AccountNumber="100" RowType="PRIMARY"/>
  <row AccountID="4" AccountNumber="101" RowType="PRIMARY"/>
  <row AccountID="6" AccountNumber="102" RowType="SECONDARY"/>
</root>


Then, I build the grid as follows:
var objGrid2 = new Active.Controls.Grid;
objGrid2.setColumnProperty("texts", ["AccountID", "Account Number"]);
var objGrid2Row = new Active.Templates.Row;
objGrid2.setTemplate("row", objGrid2Row);
var objGrid2XML = new Active.XML.Table;
objGrid2XML.setXML(GridXML.xml);  // GridXML is my data island
objGrid2XML.setRows("//root/row[@RowType='PRIMARY']");
objGrid2XML.setColumns(["@AccountID", "@AccountNumber"]);
objGrid2.setDataModel(objGrid2XML);
document.write(objGrid2);


What I expect from this is that the grid will only display the rows with a RowType of "PRIMARY". What the grid actually does is disaply all of the rows. In fact, I can change that .setRows() statement to this:
objGrid2XML.setRows("//root/row[@RowType='ChickenDance']");

...and I still get all of the rows. What am I doing wrong?
Duane Roelands
June 8,
The XML table normally expects all XPath expressions set before the data arrives - which is the same as calling setXML() for data island. So I guess if you move the setRows() setColumns() calls before setXML() - it should work as expected.
Alex (ActiveWidgets)
June 8,
That seems to have done the trick. Thank you!
Duane Roelands
June 8,

This topic is archived.

See also:


Back to support forum