:: Forum >>

How to I remove rows in the table.response before the grid is generated?

I read in an XML dataset that I don't have control over. But I only want the data that has a statuscode that matches "ep" and "uc".

So I was thinking:

table.response1 = table.response;
table.response = function(doc){
this.response1(doc); // first call the original one
var i, holdItem, rowCount = this.getCount();
// remove non "EP" and non "UC"
for (i=0; i<rowCount; i++) {
if (this.getData(7,i) <> "EP" || this.getData(7,i) <> "UC") {
this.delete();
}
}
}

I know the above is wrong, but I can't figure out how to do it. Thing is, I can't use the "setRowIndices" to mask them off because other filters would make still process them.

When I read in a dataset, how can I selete rows before the grid populates?
Carl
Friday, June 8, 2007
You can also use XPath to select the table rows -

table.setRows("company[ticker='MSFT' or ticker='ORCL']");

or, in your case

table.setRows("*[statuscode='ep' or statuscode ='uc']");
Alex (ActiveWidgets)
Friday, June 8, 2007
I tried the above (and some variations), but I think I'm still lost on how to format the xpath piece because I get no rows back in the grid. Might you be able to hepl with the xpath so I can bring this webpage live?

Sorry to be a pain - any help you can give would be appreciated.
table.setRows("*[statuscode='ep' or statuscode ='uc']");

I'm using (segment of XML):

<?xml version="1.0" encoding="utf-8" ?>
<NewDataSet>
<GenerateTOwners>
<UpgradeID>b0025</UpgradeID>
<UpgradeType>Transmission</UpgradeType>
<Description>Convert the Bergen-Leonia 138kV circuit Description>
<ISAInServiceDate>06/01/2008</ISAInServiceDate>
<ProjectedInServiceDate>05/01/2008</ProjectedInServiceDate>
<StatusCode>EP</StatusCode>
<PercentComplete>15</PercentComplete>
<Region>PJM MA</Region>
<State>NJ</State>
<County>Bergen</County>
<TransmissionOwner>PSEG</TransmissionOwner>
<RevisedDesc>The Bergen-Leonia 138kV </RevisedDesc>
<StudyYear>2000 RTEP Baseline</StudyYear>
<CostEstimate>20.00</CostEstimate>
<Location>Bergen-Leonia</Location>
<Equipment>Circuit</Equipment>
<Driver>Contingency Overload</Driver>
<Task>Convert</Task>
</GenerateTOwners>
</GenerateTOwners>
</NewDataSet>

Carl
Friday, June 8, 2007
I'm a moron - never mind. Forgot bout case-sensitivty.

My bad - thanks for the help.

Carl
Friday, June 8, 2007
I guess it should be

table.setRows("*[StatusCode='EP' or StatusCode='UC']");

- XPath is case-sensitive.
Alex (ActiveWidgets)
Friday, June 8, 2007
oops, too late :-)
Alex (ActiveWidgets)
Friday, June 8, 2007

This topic is archived.


Back to support forum

Forum search