-
Adding a row to spry XMLDataSet
I have a Spry.Data.XMLDataSet I want a row to be added in the 1st location and also get highlighted when it appears in my table.
var ds1 = new Spry.Data.XMLDataSet("/xml/data.xml", "rows/row");
var pv1 = new Spry.Data.PagedView( ds1 ,{ pageSize: 10 , forceFullPages:true, useZeroBasedIndexes:true});
var pvInfo = pv1.getPagingInfo();
Here is the data.xml
<?xml version="1.0" encoding="UTF-8"?>
<rows>
<row id="a">
<name>Abhishek</name>
<host>windows_Abhishek</host>
</row>
<row id="b">
<name>Rahul</name>
<host>windows_Rahul</host>
</row>
</rows>
This is what I am doing after a button click, But it does not seem to work, can somebody help?
function addRow()
{
var newRow = new Array();
var nextID = ds1.getRowCount();
alert(nextID);
newRow['ds_RowID'] = nextID;
newRow['id'] = "c";
newRow['name'] = "CJ";
newRow['desc'] = "windows_CJ";
ds1.dataHash[newRow['ds_RowID']] = newRow;
ds1.data.push( newRow);
ds1.setCurrentRow(newRow.ds_RowID);
Spry.Data.updateRegion(ds1);
ds1.loadData();
}
After updateRegion(ds1) my ds1.getRowCount() shows that there is a increment in the size, but it's not getting reflected in my table (spry Region) please help somebody
Last edited by abhisheksimion; 05-03-2011 at 10:45 PM.
Reason: improved formatting
-
I managed to make it work by calling a sort
ds1.sort('name','descending');
ds1.setCurrentRow(newRow.ds_RowID);
It solved my problem
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks