Forum


22:24

23/07/2010

Hi,
Im using the Master Detail grid to add/update data in my database.
The first Grid (Categories) is working fine (add/update). When I select an item, the second Grid (Labels) are populed and I can edit, so far so good. But I cant add an item whitout the Categories ID.
How can I send the Categories ID in the add submit method of Labels Grid?
Ps.: I receiving this data when do the submit in Labels: title=test&oper=add&id=_empty
And I want to receive this way: id_cat=3&nome=teste&oper=add&id=_empty
Tks
22:58

23/07/2010

Version: 3.7.2
Categories:
jQuery("#categoria").jqGrid({
url: 'categoria_listar.asp',
datatype: "xml",
colNames: ['Título'],
colModel: [
{ name: 'nome', width: 520, editable: true, edittype: 'text', editrules: { required: true }, editoptions: { size: 37, maxlength: 50 }, sortable: false }
],
rowNum: 10,
rowList: [10, 20, 30],
pager: '#pager_categoria',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
multiselect: false,
caption: "Categorias",
id: "asin",
editurl: "categoria_add_alt.asp",
pgtext: "Página {0} de {1}",
emptyrecords: "Sem registro",
loadtext: "Carregando…",
recordtext: "Ver {0} – {1} de {2}",
onSelectRow: function(ids) {
if (ids == null) {
ids = 0;
if (jQuery("#rotulo").jqGrid('getGridParam', 'records') > 0) {
jQuery("#rotulo").jqGrid('setGridParam', { url: "rotulo_listar.asp?id=" + ids, page: 1 });
jQuery("#rotulo").jqGrid('setCaption', "Rótulos")
.trigger('reloadGrid');
}
} else {
jQuery("#rotulo").jqGrid('setGridParam', { url: "rotulo_listar.asp?id=" + ids, page: 1 });
jQuery("#rotulo").jqGrid('setCaption', "Rótulos")
.trigger('reloadGrid');
}
jQuery("#pager_rotulo").css("display", "block");
}
});
jQuery("#categoria").jqGrid('navGrid', '#pager_categoria', { add: true, edit: true, del: true, search: false, refresh: false });
Labels:
jQuery("#pager_rotulo").css("display","none");
jQuery("#rotulo").jqGrid({
url: 'rotulo_listar.asp',
datatype: "xml",
colNames: ['ID Cat.', 'Título'],
colModel: [
{ name: 'id_cat', width: 20, editable: false, sortable: false, hidden: true, editable: true, editoptions: { value: jQuery("#categoria").jqGrid('getGridParam', 'selrow')} },
{ name: 'nome', width: 520, editable: true, edittype: 'text', editrules: { required: true, custom: true, custom_func: checarCampo }, editoptions: { size: 37, maxlength: 50 }, sortable: false }
],
rowNum: 5,
rowList: [5, 10, 20],
pager: '#pager_rotulo',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
multiselect: false,
caption: "Rótulos",
id: "asin",
editurl: "rotulo_add_alt.asp",
pgtext: "Página {0} de {1}",
emptyrecords: "Sem registro",
loadtext: "Carregando…",
recordtext: "Ver {0} – {1} de {2}",
edit: {
onclickSubmit: function(params, postdata) {
alert(params);
}
}
}).navGrid('#pager_rotulo', { add: true, edit: true, del: false, search: false, refresh: false });
These bold codes dont work.
Most Users Ever Online: 715
Currently Online:
59 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