Action before save
I have a grid. If I click on add button in grid a dialog open which shows some textboxes.
During enter values into textboxes I store some customized data in local variable.
How I can save this?
I have try with beforBatchSave, but it dosen't work. I mean I will save data if I click on dialog save button. The textbox values are correct saved. But the "var value" dosent save into database.
My custom value is on dropdown change event.
var ProductName;
$(function () {
var dataManager = ej.DataManager({
url: "/api/Product",
adaptor: new ej.WebApiAdaptor(),
offline: true
});
dataManager.ready.done(function (e) {
$("#Grid").ejGrid({
dataSource: ej.DataManager({
json: e.result,
adaptor: new ej.remoteSaveAdaptor(),
insertUrl: "/api/Product/Insert",
updateUrl: "/api/Product/Update",
removeUrl: "/api/Product/Remove",
}),
toolbarSettings: {
showToolbar: true,
toolbarItems: ["add", "edit", "printGrid", "search"]
},
editSettings: {
allowEditing: true,
allowAdding: true,
allowDeleting: false,
showDeleteConfirmDialog: true,
editMode: "dialogtemplate",
dialogEditorTemplateID: "#templateForm",
},
isResponsive: true,
enableResponsiveRow: true,
allowSorting: true,
allowSearching: true,
allowFiltering: true,
filterSettings: {
filterType: "excel",
maxFilterChoices: 100,
enableCaseSensitivity: false
},
allowPaging: true,
pageSettings: { pageSize: 100, printMode: ej.Grid.PrintMode.CurrentPage },
columns: [
{ field: "ProductId", type: 'number', headerText: 'OD-No.', defaultValue: 0, isPrimaryKey: true, isIdentity: true, visible: false },
{ field: "Barcode", type: 'string', headerText: 'P/N', validationRules: { required: true } },
{ field: "ISO", type: 'string', headerText: 'ISO', validationRules: { required: true } },
{ field: "TypeList", headerText: 'Type1', foreignKeyField: "TypeId", foreignKeyValue: "Name", dataSource: dataManagerType, validationRules: { required: true } },
{ field: "SupplierPN", type: 'string', headerText: 'SupplierPN', visible: false },
],
actionComplete: "complete",
});
});
});
function complete(args) {
bindDataFromWebApi();
gridActionNotification(args);
if (args.requestType == 'add') {
formatFormControlGeneral();
startup();
$.ajax({
url: "/api/Product/GetLastId",
type: "GET",
success: function (data1) {
if (data1 == "") {
ODNumber = "516000";
}
else {
ODNumber = data1 + 1;
}
GenerateODNo();
}
});
}
}
$("#SpecList").ejDropDownList({
dataSource: dataManagerMaterial2,
fields: { value: "Name", text: "MatNo" },
enabled: false,
change: function (e) {
Material = e.text;
},
validationRules: { required: false },
validationMessage: { required: 'is required.' },
});
SIGN IN To post a reply.
1 Reply
SE
Sathyanarayanamoorthy Eswararao
Syncfusion Team
November 13, 2019 12:48 PM UTC
Hi Marvin,
Thanks for using Syncfusion products.
We could not understand your query clearly. Please share the following details , so that we can understand the query better and provide the solution as soon as possible.
- Do you want to update the value of the custom global variable in the database using the grid actionComplete event?
- Or Do you want to send the custom variable value to the server side in an ajax post in the change event of dropdown?
- Please share the exact scenario of your requirement.
- If possible please share a video demo of your requirement.
Regards,
Sathyanarayanamoorthy
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
MA Marvin
- Nov 12, 2019 08:37 AM UTC
- Nov 13, 2019 12:48 PM UTC