jqGrid: subgrid não preenche com dados
Eu tenho uma sub-grade que, quando você clica no sinal "+" ao lado de "Queijo", a consulta ajax é acionada e vejo os nomes das colunas da sub-grade, mas os dados reais não são preenchidos na sub-grade. O problema ocorre independentemente de qual grade eu tento expandir, mas o exemplo "Queijo" é o mostrado abaix
Você pode ver a resposta XML na parte inferior da saída do FireBug na captura de tela. Eu li esse XML e parece válido. Em um palpite, também colei a saída XML emesta págin, e parece recuar muito bem. Além disso, também tive a chamada ajax retornando alguns valores muito básicos e, não importa o que eu tentei até agora, a grade permanece vazi
O que você deve ver na sub-grade é:
------------------------------------------------------
|Translations | Language | Active |
------------------------------------------------------
| It's cheesy goodness | EN | No |
| fromage | FR | No |
| | DE | N/A | <-- "N/A" means there's no translation of "cheese" in German, currently in the database
... etc., with all supported languages listed.
O código para a sub-grade é:
$("#translationsList").jqGrid({
caption : "Translations",
datatype : "xml",
url : translationsFeed,
editurl : translationsEdit,
mtype : "get",
pager : "#translationsPager",
rowNum : 20,
autowidth : true,
sortname : "phrase",
sortorder : "asc",
viewrecords : true,
multiselect : false,
hidegrid : false,
height : 300,
altRows : true,
rownumbers : true,
toolbar : [false],
colNames : ["phrase_id", "translation_id", "language_cd", "Phrase", "Translation", "Created", "Modified", "Active"],
colModel : [
{ name : "phrase_id", index : "phrase_id", sortable : true, search : false, editable : true, edittype : "text", editrules: { edithidden :true }, hidden : true},
{ name : "translation_id", index : "translation_id", sortable : false, search : false, editable : true, edittype : "text", editrules: { edithidden :true }, hidden : true},
{ name : "language_cd", index : "language_cd", sortable : true, search : true, editable : true, edittype : "text", editrules: { edithidden: true, required : true }, hidden : true },
{ name : "Phrase", width:200, index : "phrase", sortable : true, search : true, editable : true, edittype : "text", editrules: { required : true } },
{ name : "Translation", width:200, index : "translation", sortable : true, search : true, editable : true, edittype : "text", editrules: { required : false } },
{ name : "Created", width:100, index : "modify_dt", sortable : true, search : true },
{ name : "Modified", width:100, index : "create_dt", sortable : true, search : true },
{ name : "Active", width:20, index : "active", sortable : true, search : true, editable : true, edittype : "select", editoptions:{value:"0:No;1:Yes"} }
],
onSelectRow: function(id) {
jQuery('#translationsList').editRow(id, true);
},
subGrid: true,
subGridUrl: 'ajax/translations_subgrid_feed.php',
subgridtype: 'xml',
subGridModel : [{
name : ['Translations', 'Language', 'Active'],
width : [583, 70, 80],
align : ['left','right','right'],
params : ['phrase_id']
}],
subGridOptions: {
plusicon : "ui-icon-plus",
minusicon : "ui-icon-minus",
openicon: "ui-icon-carat-1-sw",
expandOnLoad: true,
selectOnExpand : false,
reloadOnExpand : true
}
});
A resposta XML para as principais / subgrades pode ser encontrada emthis Gist