简体   繁体   中英

How to use Kendo-grid into Angular-ngRepeat

How to produce kendo-grid with different data for each iteration of ng-repeat ?

HTML code:

<div ng-repeat="PricesPerGroup in AllGroups">
    <kendo-grid options="GridOptions"></kendo-grid>
</div>

JavaScript code:

$scope.GridOptions = {
    dataSource: {
        data: {
            (data is current 'PricesPerGroup' - Should bring it from ng-repeat)
        }
    }
}

Try to use helper function that would return proper config object:

<div ng-repeat="PricesPerGroup in AllGroups">
    <kendo-grid options="getGridOptions(PricesPerGroup)"></kendo-grid>
</div>

And in controller:

$scope.getGridOptions = function(data) {
    return {
        dataSource: {
            data: data
        }
    };
};

Demo: http://dojo.telerik.com/eFaXA

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM