I want example of grid edit record with primary key
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>
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>
. . . 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
- 2 Replies
- 2 Participants
-
BB Bharat Buddhadev
- Oct 14, 2015 06:00 AM UTC
- Oct 15, 2015 08:22 AM UTC