Forum


06:03

07/11/2008

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?
09:51

Moderators
30/10/2007

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.
06:47

07/11/2008

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
07:40

Moderators
30/10/2007

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.
09:05

Moderators
30/10/2007

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.
09:09

Moderators
30/10/2007

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.
09:17

07/11/2008

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?
09:24

Moderators
30/10/2007

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

25/10/2008

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
01:06

Moderators
30/10/2007

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.
01:15

25/10/2008

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....
03:26

Moderators
30/10/2007

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.
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66