如何使用字符对网格中的特定列进行排序 [英] how to sort particular column in a grid using a character

查看:107
本文介绍了如何使用字符对网格中的特定列进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现字符索引搜索..我已经将字符a到z放置在jqgrid上方.当我单击一个字符时,网格中的指定列应显示以该字符开头的数据.

Hi, I am trying to implement a character index search..I had placed characters a to z above an jqgrid.When I click an character, the specified column in the grid should show the data starting with that character.I am able to retrive the character but unable to implement tne searching critiria and showing the result in grid.

推荐答案

在onclick函数内部使用代码

功能{
var grid =
Inside the onclick function use the code

function{
var grid =


(#" + self.options.targetId),filterOption;
filterOption = {groupOp:"OR",规则:[]};

filterOption.rules.push({field:列名,op:"bw",data:characterSelected});
if(characterSelected.lowerCase){
filterOption.rules.push({field:列名,op:"bw",数据:characterSelected.toUpperCase()});
} else {
filterOption.rules.push({field:列名,op:"bw",data:characterSelected.toLowerCase()});
}

grid [0] .p.search = true;
("#" + self.options.targetId), filterOption;
filterOption = {groupOp:"OR",rules:[]};

filterOption.rules.push({field:column name,op:"bw",data: characterSelected});
if(characterSelected.lowerCase) {
filterOption.rules.push({field:column name,op:"bw",data: characterSelected.toUpperCase()});
} else {
filterOption.rules.push({field:column name,op:"bw",data:characterSelected.toLowerCase()});
}

grid[0].p.search = true;


.extend(grid [0] .p.postData,{filters:JSON.stringify(filterOption)});
grid.trigger("reloadGrid",[{page:1,current:true}]);

}
.extend(grid[0].p.postData,{filters:JSON.stringify(filterOption)});
grid.trigger("reloadGrid",[{page:1,current:true}]);

}


这篇关于如何使用字符对网格中的特定列进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆