Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Reload grid with xmlstring
03/07/2009
04:27
Avatar
senthil
New Member
Members
Forum Posts: 2
Member Since:
03/07/2009
sp_UserOfflineSmall Offline

I have two different xmlstring as source for grid.Depending upon some codition I want to replace the previously assigned xmlstring source with new xmlstring source. I tried .trigger("reloadGrid") but it does not show the grid with new data.What I should do to replace the old source with new source and vice-versa.

Thanks

05/07/2009
23:35
Avatar
bakunin
Member
Members
Forum Posts: 6
Member Since:
03/07/2009
sp_UserOfflineSmall Offline

I have the same problem here is a sample of my code:

jQuery("#item_17").jqGrid({            
            datatype: 'xmlstring',
            datastr : item_17_xml,
            ...            
 });

Then on another jquery object, when a an event happen i have this:

var item_17_xml =  get_node("xml/main.xml",NODE.id);
jQuery("#item_17").clearGridData() ;
jQuery("#item_17").trigger("reloadGrid");

The clearGridData does work but the reloadGrid doesnt work.

05/07/2009
23:57
Avatar
senthil
New Member
Members
Forum Posts: 2
Member Since:
03/07/2009
sp_UserOfflineSmall Offline

This should re-load the grid with new source:

<script language=javascript>

LoadData = function() {

var mygrid = $("#list")[0];

sXML = "<rows><row><cell>data1</cell><cell>data2</cell></row></rows>"

if

(!mygrid.grid) {

jQuery("#list").jqGrid({datatype: 'xmlstring',datastr: sXML,width: 400,colNames: ['cell 1', 'cell 2'],colModel: [{ name: 'cell1', index: 'cell1', width: 75 },{ name: 'cell1', index: 'cell2', width: 190}],pager: jQuery('#pager'),rowNum: 10,rowList: [10, 50, 100], viewrecords: true,imgpath: 'themes/basic/images',caption: 'My first grid'}).navGrid('#pager', { add: true, edit: true, del: true});}

else

{ sXML = "<rows><row><cell>new data1</cell><cell>new data2</cell></row></rows>"

$("#list").setGridParam({ datatype: 'xmlstring', datastr: sXML }).trigger("reloadGrid"

);}}</script>

</head>

<body>

<table id="list" class="scroll" width=200></table><div id="pager" class="scroll" style="text-align:center;" width=200></div><div id="pagernav" class="scroll" style="text-align:center;"></div><input type=button onclick="LoadData()" value="Load Grid" /><input type=button onclick="LoadData()" value="Re-Load Grid"  /></body></html>

06/07/2009
12:39
Avatar
bakunin
Member
Members
Forum Posts: 6
Member Since:
03/07/2009
sp_UserOfflineSmall Offline

It now work for me, i used your sample senthill 😛

i changed this:

jQuery(”#item_17″).trigger(”reloadGrid”);

to this:

jQuery("#item_17").setGridParam({ datatype: 'xmlstring', datastr: item_17_xml }).trigger("reloadGrid");

I would like to help you but i started learning jquery a week ago so i have no idea if what you are doing can be done. 🙁

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
138 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information