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
Grid Data reload
07/11/2008
06:03
Avatar
maraki
Member
Members
Forum Posts: 6
Member Since:
07/11/2008
sp_UserOfflineSmall Offline

Hello. JQGrid i amazing but I have a problem.

I downloaded version 3.3 and I call a webservice from javascript and fill the grid using xmlstring.

The webservide takes a value from a textbox and returns data which I display in the grid.

I have all these inside an update panel.

The problem is that when I put the grid inside the update panel it dissapears.And if I disable postback of update panel the xmlstring doesn't get refreshed.I change the value of the textbox my webservice returns a new xml but the grid doesn't reloads.

I used the reloadGrid but it doesn't work.Also the pager doesn't work.

Maybe I miss some files, I don't know. Any advice?

07/11/2008
09:51
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

When using xmlstring the data after that is automatically set to local,

so you can not use the pager.

So to work this before reloading the grid do this

jQuery("mygrid").setGridParam({datatype:"xmlstring"}).trigger("reloadGrid");

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.

10/11/2008
06:47
Avatar
maraki
Member
Members
Forum Posts: 6
Member Since:
07/11/2008
sp_UserOfflineSmall Offline

Thank you Tony,

Please see my code below. Where should I reload the grid?

var xmlHttpdata;
function getMessagedata()
{
//in this panel I have the <table id="tabledata1" class="scroll"></table>
document.getElementById("PanelTable1").style.display = "inline";
var persontxt = document.getElementById("txtasf").value;
if(window.ActiveXObject)
{
xmlHttpdata=new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XmlHttpRequest)
{

xmlHttpdata=new XMLHttpRequest();
}
//call my WebService
xmlHttpdata.open("get", "http://......?txtname=" + persontxt + "",true);
xmlHttpdata.onreadystatechange=doUpdatedata;
xmlHttpdata.send(); return false;
}
function doUpdatedata()
{
if(xmlHttpdata.readyState==4)
{
if (xmlHttpdata.status == 200) {
//document.getElementById("lblHTMLOutput").innerHTML = "";
var xmlDocdata =xmlHttpdata.responseXML.xml;
var newmystr = xmlDocdata.toString();
var mystr = xmlDocdata.toString();
//alert(mystr);

$(document).ready(function(){
$("#tabledata1").jqGrid({   
url:'life_proposalstep1.aspx',
datatype: 'xmlstring',
datastr: mystr,
      colNames:['kok','aaa','bbb','fff','ddd','eee','uuu'],
      colModel:[
            {name:"ID",index:"ID", width:50, xmlmap:"ID",sorttype:'int'},
            {name:"ALNAME",index:"ALNAME", width:400, xmlmap:"ALNAME",sorttype:'text'},
             {name:"AFM",index:"AFM", width:100, xmlmap:"AFM",sortable:false},
             {name:"ABDAY",index:"ABDAY", width:100, xmlmap:"ABDAY",sortable:false,hidden:true},
            {name:"ASEX",index:"ASEX", width:100, xmlmap:"ASEX",sortable:false,hidden:true},
            {name:"AFNAME",index:"AFNAME", width:100, xmlmap:"AFNAME",sortable:false,hidden:true},
            {name:"AFATHER",index:"AFATHER", width:100, xmlmap:"AFATHER",sortable:false}
     ],
      height:210,
     imgpath: 'themes/sand/images',
     sortname: 'ID',
    viewrecords: true,
    sortorder: "desc",
      loadonce: true,
     xmlReader: {
                  root : "NewDataSet",
                  row: "Table",
                  repeatitems: false
      },
      onSelectRow: function(rowid) {
   
    var sr = jQuery('#tabledata1').getGridParam('selrow');
    rowdata = jQuery('#tabledata1').getRowData(sr);
    alert(rowdata.ID);      
   //Some other actions......
    }
 
});
});
}
}
}

I call the javascript on the ClientClick event of an image button.

Any help would be appreciated.

Thank you

10/11/2008
07:40
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Post the code where you obtain the xml string from the service.

REMEMBER - You should first obtain the xml string, ensure that they is present and after that you can CONSTRUCT the grid.

See more about the ajax request - they are delayed and it is unknown

which is first finished.

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.

10/11/2008
08:26
Avatar
maraki
Member
Members
Forum Posts: 6
Member Since:
07/11/2008
sp_UserOfflineSmall Offline

function doUpdatedata()
{
if(xmlHttpdata.readyState==4)
{
if (xmlHttpdata.status == 200) {

var xmlDocdata =xmlHttpdata.responseXML.xml;
var newmystr = xmlDocdata.toString();
var mystr = xmlDocdata.toString();

//mystr is my xml string

Here I construct the grid........

}}

I posted above all my code...

10/11/2008
09:05
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

function doUpdatedata(){

….

var mystr = xmlDocdata.toString();

$(”#tabledata1″).jqGrid({   
datatype: 'xmlstring',
datastr: mystr,

})

} //END OF function

See my note about ajax requests

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.

10/11/2008
09:09
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Sorry

Have not that this should be updated

function doUpdatedata(){

var mystr = xmlDocdata.toString();

$(”#tabledata1″).setGridParam({datatype:'xmlstring',datastr:mystr}).

trigger(”reloadGrid”);

}

Regards

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.

10/11/2008
09:17
Avatar
maraki
Member
Members
Forum Posts: 6
Member Since:
07/11/2008
sp_UserOfflineSmall Offline

Sorry,

I get a message for javascript error :

object doesn't support this property or methos.

I guess this is caused by

$(”#tabledata1″).setGridParam({datatype:'xmlstring',datastr:mystr}).

triggrer(”reloadGrid”);

because only when I add it to my page I get the error.

Is there some other way to empty the grid each time i puss the button and then fill it?

10/11/2008
09:24
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Create the grid before calling this function and set datatype : 'local' and all will be OK

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.

11/11/2008
02:17
Avatar
maraki
Member
Members
Forum Posts: 6
Member Since:
07/11/2008
sp_UserOfflineSmall Offline

Thank you Tony for your help!

Unfortunately it still gives me error.

I can't make it work so I think I am not going to use it.

I don't now where to put

$(”#tabledata1″).setGridParam({datatype:'local'}).

trigger(”reloadGrid”); in my code.

Thank you for everything!

11/11/2008
03:40
Avatar
maraki
Member
Members
Forum Posts: 6
Member Since:
07/11/2008
sp_UserOfflineSmall Offline

Dear Tony I found the solution

Just before I create the grid I use

JQuery("mygrid").Gridunload();

and everything works fine thank you for your help

23/11/2008
11:13
Avatar
Luigino
Member
Members
Forum Posts: 47
Member Since:
25/10/2008
sp_UserOfflineSmall Offline

Hello maraki and Tony...

I'm trying to use the Gridunload function before to create the grid, I have set to true inside function jqGridInclude() to have availability of advanced functions of the grid with grid.custom.js but once the Gridunload() fires it says to me:

jQuery("#list").Gridunload is not a function

why?....

I loaded those scripts:

wp_enqueue_script('jq1', get_bloginfo('wpurl') . '/wp-content/plugins/toscanoviaggi/js/jquery.jqGrid.js', array('jquery'));
wp_enqueue_script('jq2', get_bloginfo('wpurl') . '/wp-content/plugins/toscanoviaggi/js/jqModal.js', array('jquery'));
wp_enqueue_script('jq3', get_bloginfo('wpurl') . '/wp-content/plugins/toscanoviaggi/js/jqDnR.js', array('jquery'));

which they should be ok.... maybe I missed something? or some library to load?...

Thanks!

Ciao

Luigi

24/11/2008
01:06
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

You can not use GridUnload if you do not load the needed files for this

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.

24/11/2008
01:15
Avatar
Luigino
Member
Members
Forum Posts: 47
Member Since:
25/10/2008
sp_UserOfflineSmall Offline

Uh? Isn't the Gridunload function included in the grid.custom.js loaded by the jqGridInclude() function?

In fact in that file I have this row enabled:

{ include: true, incfile:'grid.custom.js',minfile: 'min/grid.custom-min.js'}, //jqGrid custom

Plus I did a search word in all .js files and looks like only that file contains the Gridunload() function....

26/11/2008
07:40
Avatar
Luigino
Member
Members
Forum Posts: 47
Member Since:
25/10/2008
sp_UserOfflineSmall Offline

Or, shall I have to add something like:

after those lines that loads jQuery.jqGrid.js, jqModal.js, jqDnR.js?

26/11/2008
07:42
Avatar
Luigino
Member
Members
Forum Posts: 47
Member Since:
25/10/2008
sp_UserOfflineSmall Offline
27/11/2008
03:26
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Try this GridUnload and not jGridunload

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:
70 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