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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Action before save

Thread ID:

Created:

Updated:

Platform:

Replies:

149023 Nov 12,2019 08:37 AM UTC Nov 13,2019 12:48 PM UTC jQuery 1
loading
Tags: ejGrid
Marvin
Asked On November 12, 2019 08:37 AM UTC

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.' },
            });


Sathyanarayanamoorthy Eswararao [Syncfusion]
Replied On 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.

Regards, 
Sathyanarayanamoorthy 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon