这里我为wijmo网格创建了相同的指令,这里我的问题是我无法获取选定的行值,如何在指令中更改部分? 提前致谢
app.directive('customFlexGrid', function ($compile) {
return {
restrict: 'E',
template: '<div/>',
replace: true,
scope: {
itemsSource: '=',
gridheader: '='
},
link: function (scope, element, attrs) {
var grid = new wijmo.grid.FlexGrid(element[0]);
scope.$watch('itemsSource', function () {
grid.itemsSource = scope.itemsSource;
grid.columns[1].width = 300;
grid.selectionMode= "Row";
grid.isReadOnly=true;
});
}
}
最佳答案
网格的“selection”属性返回包含所选内容的 CellRange 对象。它是一个获取/设置属性,因此您可以随时使用它来查找选择了哪些行和列,或者修改选择。
如果选择单个单元格,则该范围的“row”和“col”属性将包含所选行和列的索引。如果选择了范围,则可以使用范围“topRow”、“leftCol”、“bottomRow”和“rightCol”来获取范围。
此链接描述了 CellRange 对象的其他有用方法和属性:
https://wijmo.com/5/docs/topic/wijmo.grid.CellRange.Class.html
关于javascript - 如何使用 Wijmo 网格获取选择更改的对象值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36545471/