找回密码
 立即注册

QQ登录

只需一步,快速开始

vanguard
论坛元老   /  发表于:2015-9-30 10:45  /   查看:4289  /  回复:3

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

3 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2015-9-30 15:19:00
沙发
回复 1楼vanguard的帖子

可以使用 sortingColumn 事件取消希望禁止排序的列排序动作:

  1. $(document).ready(function () {

  2.     // generate some random data
  3.     var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
  4.         data = [];
  5.     for (var i = 0; i < countries.length; i++) {
  6.         data.push({
  7.             country: countries[i],
  8.             downloads: Math.round(Math.random() * 20000),
  9.             sales: Math.random() * 10000,
  10.             expenses: Math.random() * 5000
  11.         });
  12.     }

  13.     // wrap data in a CollectionView to get updates
  14.     // (so editing the grid updates the chart)
  15.     var view = new wijmo.collections.CollectionView(data);

  16.     // create grid and show data
  17.     var grid = new wijmo.grid.FlexGrid('#theGrid');
  18.     grid.itemsSource = view;
  19.     grid.allowSorting=true;

  20.     grid.draggingColumn.addHandler(
  21.         function(s, e){
  22.             alert("The CellType you are currently dragging is: " + wijmo.grid.CellType[e.panel.cellType]);
  23.         }
  24.     );
  25.    
  26.     grid.sortingColumn.addHandler(
  27.         function(s,e){
  28.             if(e.col==0)
  29.             {
  30.               e.cancel=false;   
  31.             }
  32.             else
  33.             {
  34.                 e.cancel=true;
  35.             }
  36.             
  37.         }
  38.     )
  39.    
  40. });
复制代码
回复 使用道具 举报
vanguard
论坛元老   /  发表于:2015-9-30 16:00:00
板凳
回复 2楼iceman的帖子

能不能不根据列的位置判断,能不能根据列明判断
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-9-30 17:48:00
地板
回复 3楼vanguard的帖子

可以通过以下方法获取列名:

  1. grid.columns[e.col]._hdr
复制代码
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部