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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

I want example of grid edit record with primary key

Thread ID:

Created:

Updated:

Platform:

Replies:

120773 Oct 14,2015 06:00 AM UTC Oct 15,2015 08:22 AM UTC JavaScript 2
loading
Tags: ejGrid
Bharat Buddhadev
Asked On October 14, 2015 06:00 AM UTC

Technology must be angular js and mvc

Waiting for you quick reply

Bharat Buddhadev
Replied On October 14, 2015 06:44 AM UTC

I also want to access primary key data while edit record

Balaji Marimuthu [Syncfusion]
Replied On October 15, 2015 08:22 AM UTC

Hi Bharat,

Thanks for contacting Syncfusion support.

Query: I want example of grid edit record with primary key

We have created a sample using editing with primary key and editing is performed based on the primary key column. Refer to the sample and code example as follows,
http://jsplayground.syncfusion.com/rbfwjtln

<div id="Grid" ej-grid e-datasource="data" e-editsettings="edit" e-toolbarsettings="tool" e-allowpaging="true" e-beginedit="beginEdit">


                    <div e-columns>

                        <div e-column e-field="EmployeeID" e-headertext="Employee ID" e-isprimarykey="true" e-textalign="right" e-width="90"></div>

                        <div e-column e-field="LastName" e-headertext="Last Name" e-textalign="left" e-width="90"></div>

                        <div e-column e-field="FirstName" e-headertext="FirstName" e-textalign="left" e-width="90"></div>

                        <div e-column e-field="Title" e-headertext="Title" e-textalign="left" e-width="90"></div>

                        <div e-column e-field="City" e-headertext="City" e-textalign="left" e-width="90"></div>

                        <div e-column e-field="Country" e-headertext="Country" e-textalign="left" e-width="90"></div>


                    </div>

angular.module('listCtrl', ['ejangular'])

        .controller('PhoneListCtrl', function ($scope) {

            $scope.data = obj;

            $scope.edit = { allowEditing: true, allowAdding: true, allowDeleting: true };

            . . .
       });


Refer to the helpdocument:
http://help.syncfusion.com/js/api/ejgrid#members:columns-isprimarykey


Please find the document and online demo for Editing in following link:
http://help.syncfusion.com/js/grid/editing
http://js.syncfusion.com/demos/web/#!/azure/grid/editing/inlineonlocaldata


Query:2 I also want to access primary key data while edit record

In beginEdit event, you can access the primary key data while editing record by using args.primaryKeyValue. Refer to the code example and help document.
http://help.syncfusion.com/js/api/ejgrid#events:beginedit


<div id="Grid" ej-grid e-datasource="data" e-editsettings="edit" e-toolbarsettings="tool" e-allowpaging="true" e-beginedit="beginEdit">


                    <div e-columns>

                        <div e-column e-field="EmployeeID" e-headertext="Employee ID" e-isprimarykey="true" e-textalign="right" e-width="90"></div>


                        . . .
                    </div>

angular.module('listCtrl', ['ejangular'])

        .controller('PhoneListCtrl', function ($scope) {

            $scope.data = obj;

            . . .


           $scope.beginEdit = function (args) {

                var primarykeydata = args.primaryKeyValue[0]; //get primary key value

                alert(primarykeydata);

            }
        });


If we misunderstood your requirement, please share how you want to access the primary key data while editing the record in Grid.

Regards,
Balaji Marimuthu

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.

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

;