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

Kendo UI Grid - Angular - Custom command

4 Answers 244 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Quỳnh
Top achievements
Rank 1
Quỳnh asked on 23 Oct 2015, 09:00 AM

I have grid and custom command 

In function of custom command I change $scope variable:

  $scope.editLanguage = function (e) {
                var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
                $scope.name = dataItem.Name;
                $scope.key = dataItem.Keyword;
                $scope.ID = dataItem.ID;
                $scope.Image = dataItem.Image;
                //$scope.windowEditLanguage.center();
                //$scope.windowEditLanguage.open();
            }

 

But It's not work , but if I add some code to handle somethings it's work. but I just want change variale to display imedietly.

$scope.mainGridOptions = {
              dataSource: {
                  type: "json",
                  transport: {
                      read: "@Url.Action("getLanguage", "DataJson")",
                  },
                  pageSize: 8,
                  serverPaging: true,
                  serverSorting: true
              },
              columns: [
                  {
                      template: "<div>" +
                                      "<img src='../../Upload/#:data.Image#' style='max-width:100px; max-height:100px;'/>"+
                                      "</div>"
                                 ,
                      field: "Image",
                      title: "Hình ảnh",
                      width: 200
                  }, {
                      field: "ID",
                      title: "ID",
                      width: "120px"
                  }, {
                      field: "Name",
                      title: "Tên",
                      width: "120px"
                  }, {
                      field: "Keyword",
                      title: "Từ khóa",
                      width: "120px"
                  },
                 { command: { text: "Chỉnh sửa", click: $scope.editLanguage }, title: " ", width: "80px" },
 
               { command: { text: "Xóa", click: $scope.deleteLanguage }, title: " ", width: "80px" },
              ],
              editable: "inline",
              height: 800,
              scrollable: true,
              selectable: true
          };

4 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 26 Oct 2015, 03:08 PM

Hello Truc,

 

Could you please explain a bit more on how $scope.name, $scrop.key and etc are displayed to the user? 

 

Please extract a runnable sample in a Kendo UI Dojo and we will be happy to help.

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Quỳnh
Top achievements
Rank 1
answered on 27 Oct 2015, 04:03 AM
it doesn't matter what $scope.name or ect is. I just want change value of them in event click of button, but it doesn't work. 

if I add some code like open or close kendo window it work .
0
Quỳnh
Top achievements
Rank 1
answered on 27 Oct 2015, 04:33 AM

http://dojo.telerik.com/eMOrI

 

 

Like this Example

0
Boyan Dimitrov
Telerik team
answered on 28 Oct 2015, 03:44 PM

Hello Truc,

 

In this case $scope.apply should be used in order to apply the changes made to the $scope variables. Please refer to the http://dojo.telerik.com/eMOrI/4 example. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Quỳnh
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Quỳnh
Top achievements
Rank 1
Share this question
or