We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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) {

                    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) {


            if (args.requestType == 'add') {


                    url: "/api/Product/GetLastId",
                    type: "GET",
                    success: function (data1) {
                        if (data1 == "") {
                            ODNumber = "516000";
                        else {
                            ODNumber = data1 + 1;



                dataSource: dataManagerMaterial2,
                fields: { value: "Name", text: "MatNo" },
                enabled: false,
                change: function (e) {
                   Material = e.text;
                validationRules: { required: false },
                validationMessage: { required: 'is required.' },

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. 

  1. Do you want to update the value of the custom global variable  in the database using the grid actionComplete event?
  2. Or Do you want to send the custom variable value to the server side in an ajax post in the change event of dropdown?
  3. Please share the exact scenario of your requirement.
  4. If possible please share a video demo of your requirement.


Live Chat Icon For mobile
Up arrow icon