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
Table Refresh?
26/01/2009
23:40
Avatar
notsoceo
New Member
Members
Forum Posts: 2
Member Since:
26/01/2009
sp_UserOfflineSmall Offline

Hello,

I'm new to jqGrid and I'm having a little trouble.

I'm trying to constantly refresh a changing data source.

Here's my code:

      setInterval(function (){
         $.ajax({
            url:'datatest.php',
            cache: false,
            success: function(testdata) {
             $("#list1").jqGrid({
               datastr: testdata,
               datatype: "xmlstring",
               colNames:['ColA','ColB', 'ColC', 'ColD'],
               colModel:[
                  {name:'ColA', xmlmap:"COLA"},
                  {name:'ColB', xmlmap:"COLB"},
                  {name:'ColC', xmlmap:"COLC"},
                  {name:'ColD', xmlmap:"COLD"}
               ],
               loadtext: false,
               height:'100%',
               xmlReader: {
                  root:"ROOT",
                  row:"ROWS",
                  page: 1,
                  total: 1,
                  records: "SESSION>rows",
                  repeatitems: false },
               viewrecords: true,
               sortorder: "asc",
               caption:"Table Refresh Test"
               });
         }
      })
      }, 5000);

The table loads fine but will not refresh. I can see the jQuery ajax requests completing in the Firebug Console but the table contents remain stale. Moreover, I added .trigger("reloadGrid") without any success other than I saw the red "Loading..." box every 5 seconds but the data did not update.

Thanks in advance,

Chris

27/01/2009
03:58
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello

$(”#mygrid”).jqGrid({…..});

setInterval(function() { $(”#mygrid”).trigger(”reloadGrid”);},5000);

Also search this forum, there is a working exmple here.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

27/01/2009
20:40
Avatar
notsoceo
New Member
Members
Forum Posts: 2
Member Since:
26/01/2009
sp_UserOfflineSmall Offline

ahh…sorry, I forgot to mention, I want to load and use the xml file for processing in addition to jqGrid. In other words, grab the file and process it using jqGrid and then process it using something else to present non-grid data.

Thanks again in advance,

Chris

29/01/2009
06:14
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hell,

As you see here you try to CREATE every time the grid after some interval - right?

This will not work after first time since there is a checking if the grid exists.

If the grid exists and you try to create it again nothing will be happen.

In you case I recommend you to check if the grid exist first

also in your ajax function

if(grid does not exists) {

//create the grid here

} else {

// triger to reload the grid

}

To check if the grid exists:

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

if(mygrid.grid) // grid exists

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
38 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