में सेल परिवर्तनों का पता लगाना मैंने अपने दिमाग को रैक किया है लेकिन एनजी-ग्रिड में सेल डेटा परिवर्तन का पता लगाने में असमर्थ हूं। निम्न स्निपेट एनजी-चेंज का उपयोग कर रहा है जो सही ढंग से कॉल() को कॉल करता है, लेकिन यह ट्रिगर नहीं है क्योंकि मैं चाहता हूं कि इसे किसी भी कुंजी प्रविष्टि के लिए बुलाया जाए। मुझे पता होना चाहिए कि का संपादन कब पूरा हो गया है।angular.js और ng-grid
किसी भी मदद की सराहना की जाएगी।
angular.module('controllers', ['ngGrid']).
controller('ContactsListCtrl', ['$scope', 'Contacts', function ($scope, Contacts) {
var editableCellTemplate = '<input type="text" ng-class="\'colt\' + col.index" ng-input="COL_FIELD" ng-model="COL_FIELD" ng-change="save()"/>';
Contacts.get(function(data) {
$scope.contacts = data;
});
$scope.gridOptions = {
data: 'contacts',
enableCellSelection: true,
enableRowSelection: false,
enableCellEdit: true,
showSelectionCheckbox: true,
columnDefs: [
{field: 'lastName', displayName: 'Last Name', enableCellEdit: true, editableCellTemplate: editableCellTemplate},
{field: 'firstName', displayName: 'First Name', enableCellEdit: true, editableCellTemplate: editableCellTemplate},
{field: 'email', displayName: 'EMail Address', enableCellEdit: true, editableCellTemplate: editableCellTemplate},
{field: 'phone', displayName: 'Phone', enableCellEdit: true, editableCellTemplate: editableCellTemplate}
]
};
$scope.save = function() {
$scope.contact = this.row.entity;
Contacts.save($scope.contact);
}
}]);
यदि आप एक ही दायरे में दो (या अधिक) ग्रिड है, तुम कैसे जानते हो जो इन ग्रिड का 'ngGridEventEndCellEdit' गतिविधि सक्रिय? – sports
'event.targetScope.gridId' का उपयोग करके आप यह पहचान सकते हैं कि किस ग्रिड ने इस ईवेंट को उत्सर्जित किया है। –