Forum
Topic RSS
10:23
Hi,
For several days i have been reading the documentation, demonstration examples and the forum to find the solution to my problems. I'm Using jqgrid 3.5 with an xml file.
First One: Searching records does nothing;
Second: Data isn't saved to the xml file.
First case:
I use the search box from navgrid menu.
Searching for data in the grid does nothing, it just stays where it is withought filtering the record nor focusing it.
Second case:
Whenever i edit, add or delete records in the grid, it only saves localy and not on the xml file.
Could anyone help me?
Thanks in advance.
Here is my html:
…
<link rel=”stylesheet” type=”text/css” media=”screen” href=”css/redmond/jquery-ui-1.7.1.custom.css” />
<link rel=”stylesheet” type=”text/css” media=”screen” href=”css/ui.jqgrid.css” />
<script src=”js/jquery-1.3.2.min.js” type=”text/javascript”></script>
<script src=”js/i18n/grid.locale-en.js” type=”text/javascript”></script>
<script src=”js/jquery.jqGrid.min.js” type=”text/javascript”></script>
<script type=”text/javascript”>
var lastSel;
var rowid;
var keys;
var oneditfunc;
var succesfunc;
var url;
var extraparam;
var aftersavefunc;
var errorfunc;
var afterrestorefunc;
jQuery(document).ready(function(){
jQuery(”#list”).jqGrid({
url:'contacts.xml',
datatype: 'xml',
mtype: 'GET',
colNames:['nome','Login', 'Ext','Tel','PC','Printer', 'Local', 'E-mail'],
colModel :[
{name:'nome', index:'nome', xmlmap:"nome", editable:true, search:true, stype:'text',},
{name:'login', index:'login', width:50, xmlmap:"login", editable:true},
{name:'ext', index:'ext', width:50, align:'right', xmlmap:"ext", editable:true},
{name:'tel', index:'tel', width:50, align:'right', xmlmap:"tel", editable:true},
{name:'pc', index:'pc', width:70, align:'right', xmlmap:"pc", editable:true},
{name:'printer', index:'printer', align:'right', width:80, sortable:false, xmlmap:"printer", editable:true},
{name:'local', index:'local', align:'right', width:80, xmlmap:"local", editable:true},
{name:'email', index:'email', align:'right', width:170, sortable:false, xmlmap:"email", editable:true}
],
xmlReader: {
root:”result”,
row:”invoice”,
page:”invoices>currentpage”,
//total:”invoices>totalpages”,
//records:”invoices>totalrecords”,
repeatitems:false,
},
pager: jQuery('#pager'),
rowNum:500,
rowList:[10,20,30],
sortname: 'nome',
sortorder: 'asc',
id: 'id',
viewrecords: true,
loadonce: true,
caption: 'Lista Contactos',
editurl: 'contacts.xml',
}).navGrid('#pager',{view:true, del:true},
{reloadAfterSubmit:false, }, // edit options
{reloadAfterSubmit:false,}, // add options
{reloadAfterSubmit:false}, // del options
{Find: “Go”, multipleSearch:true,} // search options
);
//{edit:true,add:true,del:true});
jQuery(”#list”).editRow(rowid, keys, oneditfunc, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc);
jQuery(”#list”).saveRow(rowid, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc);
});
</script>
</head>
<body>
…
<table id=”list”></table>
<div id=”pager”></div>
…
</body>
</html>
Example of my xml file:
<?xml version =”1.0″ encoding=”utf-8″?>
<invoices>
<request>true</request>
…
<currentpage>1</currentpage>
<totalpages>10</totalpages>
<totalrecords>20</totalrecords>
<result>
<invoice>
<nome>John Doe</nome>
<login>U119468</login>
<ext></ext>
<tel>5417</tel>
<pc>PC01</pc>
<printer></printer>
<local>GF</local>
<email>john.doe@contoso.com</email>
</invoice>
……….
</result>
</invoices>
03:25
Moderators
30/10/2007
OfflineHello,
I think you misunderstud how jqGrid works.
To be a clear you use a xml file. In princip this is a static file and it is not generated from any server side language dynamically.
Short : if you load data this way you can not.
1. Perform search
2. Add/update or delete to this file (or you can do this, but you should use again server side language like PHP, ASP...)
Best 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: 994
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66
Log In
Home