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
jqGridImport example?
26/02/2009
07:28
Avatar
jlb30504
Member
Members
Forum Posts: 41
Member Since:
25/02/2009
sp_UserOfflineSmall Offline

Can someone please post a more complete example of how to use jqGridImport?  I am new to jqGrid and can't get jqGridImport to work.  jqGridExport works fine but not jqGridImport.  I even tried importing testxml.xml but it doesn't work either.

Thanks, Jerry

27/02/2009
17:28
Avatar
jlb30504
Member
Members
Forum Posts: 41
Member Since:
25/02/2009
sp_UserOfflineSmall Offline

1. jQuerry version - 1.3.1

2. jqGridVersion - 3.4.1

3. OS - Windows XP SP3

4. browser - Firefox 3.0.6

5. Problem - I can't get jqGridImport to work.  I tested with both testxml.xml as well as my own .xml file.  Firebug shows the .xml file coming back from the request but the Grid configuration does not change.

What am I doing wrong?

6. Code and data if possible -

<script type="text/javascript">
jQuery(document).ready(function (){ 
 jQuery("#list").jqGrid({
    url:'cem_db_if.php',
    colNames: ['Cemetery','County', 'First mame', 'Middle name', 'Other name(s)',
    'Surname/family','Birth date','Death date'],
    colModel :[
      {name:'cem_name', index:'cem_name', width:200, align:'center'},
      {name:'cem_county_name', index:'cem_county_name', width:100, align:'center'},
      {name:'bur_fname', index:'bur_fname', width:100, align:'center' },
      {name:'bur_mname', index:'bur_mname', width:100, align:'center' },
      {name:'bur_maiden', index:'bur_maiden', width:100, align:'center' },
      {name:'bur_sname', index:'bur_sname', width:100, align:'center'},
      {name:'bur_birthdate', index:'bur_birthdate', width:100, align:'center'},
      {name:'bur_deathdate', index:'bur_deathdate', width:100, align:'center'} ],
    height:'auto',
 pager: '#pager',
    rowNum:10,
    rowList:[10,20,30],
    sortname: 'bur_sname',
    mtype: 'POST',
 postData:{table_name:"DT_Burial"},   
 viewrecords: true,
    imgpath: 'themes/basic/images',
    caption: 'TNGenWeb Cemetery Database - Burials'
  }); //end grid
});//end ready

function burial() {
 $("#list").jqGridImport({impurl:"testxml.xml", imptype: "xml"});
 alert( $("#list").jqGridExport({exptype: "xmlstring"}) );
}//end burial

function cemetery() {
 $("#list").jqGridImport({impurl:"cemetery.xml", imptype: "xml"});
 alert( $("#list").jqGridExport({exptype: "xmlstring"}) );
}//end cemetery
</script>

...

<a href="javascript: void(0)" onclick="burial()">Test XML</a><br />
<a href="javascript: void(0)" onclick="cemetery()">Cemetery Table</a>

28/02/2009
09:13
Avatar
jlb30504
Member
Members
Forum Posts: 41
Member Since:
25/02/2009
sp_UserOfflineSmall Offline

OK, sorry, I had some coding issues above.  I am now able to get the testxml.xml file to load.  I did this by not defining the grid in the ready() but instead loading from testxml.xml to start the grid. 

Is the expected behavior of jqGridImport?  I thought that I could use jqGridImport to change the Grid definition.  It now appears that I can only use it for the intiial loading.  Is this correct?

28/02/2009
11:26
Avatar
jean
Member
Members
Forum Posts: 10
Member Since:
09/12/2008
sp_UserOfflineSmall Offline

I didn't try, but maybe a

$(”#mytable”).trigger(”reloadGrid”);

or in your case:

function burial() {
 $(”#list”).jqGridImport({impurl:”testxml.xml”, imptype: “xml”}).trigger("reloadGrid");
 alert( $(”#list”).jqGridExport({exptype: “xmlstring”}) );
}//end burial

would help.

Cheers, jean

28/02/2009
12:40
Avatar
jlb30504
Member
Members
Forum Posts: 41
Member Since:
25/02/2009
sp_UserOfflineSmall Offline

Jean,

Thanks for the suggestion but it didn't work.  The Grid reloads but the configuration is not changed.

Jerry

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

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

Hello,

If you want to do that you can  use GridUnload method  on constructed grid and then applay again import

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/03/2009
09:46
Avatar
jlb30504
Member
Members
Forum Posts: 41
Member Since:
25/02/2009
sp_UserOfflineSmall Offline

Thanks Tony,

Works like a champ!  Not sure how I missed GridUnload method.  I tried remove and empty but GridUnload was what I needed.

Jerry

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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