bombai
bombai

Reputation: 967

Jqgrid and Data send error

I have this code..

var _codSelected="";

$("#list").jqGrid({
url: '/modulos/mantenimiento/Proveedores.ashx',
datatype: 'xml',
mtype: 'GET',
colNames: ['Codigo' //Some more colnames and colmodels]
colModel: [{ name: 'Codigo', index: 'PRg_Codigo', edittype: 'select',
            editable: true, editrules: { edithidden: false }, editoptions:
            { size: 30, dataUrl: '/modulos/mantenimiento/grupoProveedores.ashx?
            oper=selectAllGroups }, sortable: true }
],
onSelectRow: function (rowid) {
_codSelected = rowid;
//alert(_codSelected);
},

When i select a row in my jqgrid, the alert (commented) is show me the value that i want to send by dataUrl to my handler, but always is empty. The alert shows it, but i cant include it in the url! Can someone tell me how can i do it?

Thanks.

EDIT

I have fixed adding this event..

ajaxSelectOptions: {
data: {
codSelected: function () {
return _codSelected;
}
}
}

Upvotes: 0

Views: 124

Answers (1)

SeanCannon
SeanCannon

Reputation: 78006

That's because _codSelected is just an empty string in the scope of the colModel array declaration. It only becomes your row id in the callback function.

If you want _codSelected to have a value to append to dataUrl, you need to give it one before referencing it inside your object literal.

Upvotes: 1

Related Questions