I have JQgrid with form edit.
jQuery("#tblPriceListUpload").jqGrid({
url: $('#tblPriceListUpload').attr("RequestUrl"),
postData: { PriceListType: SelectedPriceListType },
datatype: "json",
mtype: "Get",
hoverrows: false,
ajaxGridOptions: { timeout: 30000 },
colNames: PriceListColName,
colModel: PriceListColModel,
cmTemplate: { editable: true },
rowNum: 10,
hidegrid: false,
rownumbers: true,
pager: '#PriceListGridPager',
viewrecords: true,
caption: "Price List ",
height: 'auto',
scrollOffset: 0,
gridview: true,
shrinkToFit: true,
autoencode: true,
loadonce: true,
ignoreCase: true,
enableClear: true,
width: '1000',
beforeRequest: function () {
//responsive_jqgrid($(".jqGrid"));
}
});
$('#tblPriceListUpload').jqGrid('filterToolbar', { searchOnEnter: false, enableClear: false, defaultSearch: "cn", stringResult: true });
For Form Add
$("#tblPriceListUpload").jqGrid('navGrid', '#PriceListGridPager',
{ edit: true, add: true, del: true, refresh: true, view: false, search: false },
{ //Edit Code here
}, {
caption: "",
title: "Add Attachment",
id: "add_Attachment",
buttonicon: "ui-icon-plus",
position: "first",
url: 'AddPriceList',
recreateForm: true,
onclickSubmit: function (response, postdata) {
debugger;
if (jqXHRData) {
//jqXHRData.submit();
$("#Form").submit();
$("#FormError").remove();
}
},
beforeShowForm: function (form) {
$("#PriceListType").val(SelectedPriceListType);
$("#tr_PriceListType").hide();
$('#FileName').fileupload({
replaceFileInput: false,
dataType: 'json',
url: 'AddPriceList',
change: function (e, data) { },
add: function (e, data) {
jqXHRData = data
},
done: function (event, data) {
alert(data.result.message)
$("#cData").trigger('click');
$("#tblPriceListUpload").setGridParam({ datatype: 'json', page: 1 }).trigger("reloadGrid");
jqXHRData = null;
},
fail: function (event, data) {
if (data.files[0].error) {
alert(data.files[0].error);
}
}
});
}
}, {});
And Col Model Below
var PriceListColModel = [{ name: 'DisplayDescription', index: 'DisplayDescription', align: 'center', editable: true, },
{
name: 'Header', index: 'Header', width: 95, align: 'center', formatter: 'select', editable: true,
edittype: 'select', editoptions: { value: HeaderList, defaultValue: 'HP Oct 12 - GOs' },
stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: ':All;' + HeaderList }
},
{
name: 'OneSeriesPerPage', index: 'OneSeriesPerPage', align: 'center', formatter: 'checkbox', edittype: 'checkbox',
editoptions: { value: "true:false", defaultValue: "true" }, editable: true
},
{
name: 'EnvironmentCode', index: 'EnvironmentCode', search: true, editable: true,
edittype: 'select', editoptions: { value: EnvList, defaultValue: 'AFI' },
stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: ':All;' + EnvList }
},
{
name: 'FileName', index: 'FileName', edittype: 'file', editable: true,
edittype: 'file',
editoptions: {
enctype: "multipart/form-data"
}, search: true
},
{
name: 'PriceListType', index: 'PriceListType', align: 'center', hidden: true, editrules: {
required: true,
edithidden: true
}
}];
In "OnclickSubmit" event of "AddPriceList" if i am posting jqXHRData.submit(); If Check Box column is false it is not sending the data to controller. If true, it is sending the data to controller.
If i am posting the form $("#Form").submit(); I am not getting the file in Controller.
Please help on this issue.
Aucun commentaire:
Enregistrer un commentaire