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
close icon

I want to save grid dropdown data.

Technology must be angular js and mvc

I have two column of the grid 
1)textbox  (user will fill data)
2)dropdown should have data so use can select from dropdown



when I click on save button of the grid I want save both textbox and dropdown data.
So basically I want to access both dropdown and textbox data in grid ActionComplete




Waiting for your quick reply.



3 Replies

BM Balaji Marimuthu Syncfusion Team September 18, 2015 07:26 AM UTC

Hi Rakesh,
Thanks for contacting Syncfusion support.
Your requirement can be achieved by enabling the editType property in Grid columns. Please refer to the sample and code example below.
Sample: Sample120278





$scope.columns = [

                          { field: "EmployeeID", headerText: 'Employee ID', isPrimaryKey: true, textAlign: ej.TextAlign.Right, width: 115 }, //enable isPrimaryKey property to edit the rows

                          { field: "FirstName", headerText: 'First Name', textAlign: ej.TextAlign.Left, width: 150, editType: ej.Grid.EditingType.Dropdown },


            ]




Please refer to the help document in following link:
Document: http://help.syncfusion.com/js/api/ejgrid#members:columns-edittype


In actionComplete event, you can access both the dropdown and textbox data when requestType is save by using the args.data which return the record object.
Please refer to the help document in following link:
http://help.syncfusion.com/js/api/ejgrid#events:actioncomplete


<div id="targetsGrid" ej-grid e-datasource="data"

                     e-columns="columns"

                     e-actioncomplete="actioncomplete"

                     e-editsettings="edit"

                     e-toolbarsettings="tool"

                   ></div>



$scope.actioncomplete = function (args) {

                if(args.requestType == "save")

                    alert("EmployeeID: " + args.data["EmployeeID"] + " FirstName: " + args.data["FirstName"])

            }


Regards,
Balaji Marimuthu


BB Bharat Buddhadev September 18, 2015 09:51 AM UTC

Thanks for your last solution but I do not want to use in editmode

Here first I have to click on cell after that dropdown appears in editmode
but I want to use dropdown without click and row and make it editable.



So here my requirement is like once grid bind is done I should have access to use dropdown
 instead first click on row and then use it.


BM Balaji Marimuthu Syncfusion Team September 21, 2015 07:16 AM UTC

Hi Rakesh, 

We are sorry that we are unable to understand your requirement clearly. So please share the following details,
 


1.       When do you want to save the dropdown data to Grid?

2.       Are you using any adaptor (Url Adaptor, Remote save, WebApi Adaptor) in Grid? 

3.       To render the Grid with dropdown data and access without Edit option, use Column template in Grid. But the template column will refresh at every Grid Action. So Editing will not supported for template columns. Please refer the following Demo, 


http://js.syncfusion.com/demos/web/#!/azure/grid/columns/columntemplate


4. To use an Edit option at single click, use the Batch Editing in Grid and refer to the online demo link, 


http://js.syncfusion.com/demos/web/#!/azure/grid/Editing/BatchEditing


You can also use the command columns in Grid and refer to the following link, 


http://js.syncfusion.com/demos/web/#!/azure/grid/editing/commandcolumn


Please refer to the above provided links. If your requirement is different, please share more details which will be helpful to analyze the requirement and provide better solution at the earliest.

Regards, 
Balaji Marimuthu


Loader.
Live Chat Icon For mobile
Up arrow icon