1
我已經看到類似問題的答案,但它無能爲力。網格正在顯示,甚至數據正在傳遞,但唯一的問題是它沒有被加載到jqGrid中。 我在瀏覽器中檢查了響應,數據正在以XML格式發送。所以,唯一的問題是它沒有在瀏覽器中顯示。JQGrid數據未加載xml
var lastsel2;
$(function(){
$("#list1").jqGrid({
//url:'process/roles/GetRoles1.php',
url: 'processDragonDisplay.php',
datatype: 'xml',
mtype: 'GET',
autowidth: true,
height: 'auto',
colNames:['name', 'body', 'active_flag','Action'],
colModel :[
{name:'name', index:'name', search:true, sortable: true}
,{name:'body', index:'body', search:true, sortable: true}
,{name:'active_flag', index:'active_flag', width:30, sortable: true}
,{name: 'choice', index: 'choice',width: 50, sortable: false }
],
pager: '#pager1',
rowNum:10,
rowList:[10,20,30],
sortname: 'name',
sortorder: 'asc',
viewrecords: true,
gridview: true,
caption: 'Templates',
editurl: 'processDragonDisplay.php',
onSelectRow: function(id) {
$('#rowID').html(id);
//$('#userId123').attr('value', id);
$('#list2').trigger("reloadGrid");
if(id && id!==lastsel2){
jQuery('#list1').restoreRow(lastsel2);
jQuery('#list1').editRow(id,true);
lastsel2=id;
}
},
loadComplete: function(){
var ids = jQuery("#list1").getDataIDs();
for(var i=0;i<ids.length;i++){
var cl = ids[i];
ce = "<span class='ui-icon ui-icon-pencil' onclick=editData('"+cl+"');></span>";
$("#list1").jqGrid('setRowData', ids[i] , { choice: ce });
}
}
}).navGrid("#pager1",{edit:false, add:false, del:true});
//$("#list1").jqGrid('inlineNav','#pager1', {edit:false, del: false, add: false});
});
響應與XML數據來:
<?xml version='1.0' encoding='utf-8'?><rows><page>1</page><total>1</total><records>7</records><row id='A-000002'><cell>foo</cell><cell>bar yes ok</cell><cell>Y</cell><cell></cell></row><row id='A-000009'><cell>hello</cell><cell>hwq</cell><cell>Y</cell><cell></cell></row><row id='A-000013'><cell>nnnnn</cell><cell>nnnn</cell><cell>n</cell><cell></cell></row><row id='A-000007'><cell>t1</cell><cell>Your appointment for TOken at for will be at </cell><cell>Y</cell><cell></cell></row><row id='A-000008'><cell>t1</cell><cell>Your appointment for TOken at for will be at </cell><cell>Y</cell><cell></cell></row><row id='A-000011'><cell>test2</cell><cell>test2</cell><cell>n</cell><cell></cell></row><row id='A-000015'><cell>wwwww</cell><cell>wwwww</cell><cell>g</cell><cell></cell></row></rows>
您需要向我們展示了與您發佈不包含任何數據 – tpeczek
XML文件中的XML數據。沒有#'子元素''元素。什麼可以在網格中顯示? –
Oleg
|
sry ..我錯過了..我已經更新了XML數據。 –