This is a migrated thread and some comments may be shown as answers.

Grid in-cell editor with AngularJS directive

1 Answer 72 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Andrew asked on 08 Dec 2015, 10:07 AM

Hey folks, 

got a question around using angularjs directives to do in-cell editing in the kendo grid.

I've been using this piece of code to do in-cell editing with drop down lists.

 $scope.dropDownEditor = function (container, options) {
        $('<input data-text-field="Desc" data-value-field="Code" data-bind="value:' + options.field + '"/>')
        .appendTo(container)  .... });  };


Now - I want to use the same approach with an angularjs directive, this directive is a pop up window that allows the user to do some calculations and then return the value.  This is what that code looks like

$scope.matrixEditor = function (container, options) {
$('<risk-matrix obj-attr="options.field"></risk-matrix>').appendTo(container);

 This directive accepts the objAttr  which should be the object reference like shown in the directive declaration

restrict: 'E',
        scope: {
            objAttr: '='

The idea is that I can pass that reference so it can be set via the modal dialog, but I can't get it to work. objAtrr is always undefined.

I've tried several variation of this line ( $('<risk-matrix obj-attr="options.field"></risk-matrix>')) but nothing works.

Is this even possible?


Any helps would be really appreciated

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 10 Dec 2015, 08:44 AM

Hello Andrew,

Looking at the snippet you have pasted I guess it does not work as directive is bound to a field named options.field instead of the actual field name. A similar to the following setup should be used instead:

$('<risk-matrix obj-attr="dataItem.' + options.field + '"></risk-matrix>')

Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question