回复 1楼vanguard的帖子
可以使用 sortingColumn 事件取消希望禁止排序的列排序动作:
- $(document).ready(function () {
- // generate some random data
- var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
- data = [];
- for (var i = 0; i < countries.length; i++) {
- data.push({
- country: countries[i],
- downloads: Math.round(Math.random() * 20000),
- sales: Math.random() * 10000,
- expenses: Math.random() * 5000
- });
- }
- // wrap data in a CollectionView to get updates
- // (so editing the grid updates the chart)
- var view = new wijmo.collections.CollectionView(data);
- // create grid and show data
- var grid = new wijmo.grid.FlexGrid('#theGrid');
- grid.itemsSource = view;
- grid.allowSorting=true;
- grid.draggingColumn.addHandler(
- function(s, e){
- alert("The CellType you are currently dragging is: " + wijmo.grid.CellType[e.panel.cellType]);
- }
- );
-
- grid.sortingColumn.addHandler(
- function(s,e){
- if(e.col==0)
- {
- e.cancel=false;
- }
- else
- {
- e.cancel=true;
- }
-
- }
- )
-
- });
复制代码 |