EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: zolotoy on July 18, 2015, 03:11:26 PM



Title: Row numbers are all zeros
Post by: zolotoy on July 18, 2015, 03:11:26 PM
In my treegrid I can see my data, but all row numbers are zeros. Why is that?

Thanks


Title: Re: Row numbers are all zeros
Post by: yamilbracho on July 19, 2015, 04:31:43 PM
Could you show us the code?


Title: Re: Row numbers are all zeros
Post by: zolotoy on July 19, 2015, 06:22:52 PM
Table markup:
Code:
<table assets-treegrid ng-model="assets" fit="true" pagination="true" 
                   rownumbers="true" singleselect="true" idField="id" treeField="name"></table>

Controller:
Code:
explorer.directive('assetsTreegrid', function () {
    return {
        restrict: 'AE',
        require: 'ngModel',
        link: function (scope, elem, attrs, ngModel) {
            $(elem).treegrid({
                columns: [[
                    { field: "name", title: "Name", width: "92%" }
                ]],
                onSelect: scope.assetChanged
            });
            ngModel.$render = function (value) {
                $(elem).datagrid('loadData', ngModel.$viewValue);
            }
        }
    }
});

.......
 $scope.assets = { total: rows.length, rows: rows };
The same technique works for a number other tables including treegrids.