Register

Reply

Junior Member

Join Date: May 2011
Posts: 2
Quote  
05-03-2011, 09:43 PM
Default 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 09:45 PM. Reason: improved formatting
Reply With Quote
abhisheksimion is offline
Junior Member

Join Date: May 2011
Posts: 2
Quote  
05-04-2011, 12:52 AM
Default

I managed to make it work by calling a sort

ds1.sort('name','descending');
ds1.setCurrentRow(newRow.ds_RowID);

It solved my problem
Reply With Quote
abhisheksimion is offline
Reply

Bookmarks

Tags
html, javascript, spry

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 08:51 PM. Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 VBulletin Skin by ForumMonkeys.