js设置datagriad的行移动
2024-10-06 00:06:31
// ,
// formatter: function(value,row,index){
// var download = row.priority+
// " <a href=\"#\" id = \"V_up_"+index+"\" class=\"easyui-linkbutton\" data-options=\"iconCls:'icon-add'\" onclick=moveUp(this,"
// + index+ ","+row.priority+","+row.id+")>上移</a>"
// +"<a href=\"#\" id = \"V_down_"+index+"\" class=\"easyui-linkbutton\" data-options=\"iconCls:'icon-add'\" onclick=movedown(this,"
// + index+ ")>下移</a>";
// return download;
// }
function moveUp(value, index, priority,id) {
var $tr = $(value).parents("tr");
if ($tr.index() != 0) {
$tr.fadeOut().fadeIn();
$tr.prev().before($tr);
}
var columns = $('#dataGrid').datagrid("options").columns;
// 得到rows对象
var rows = $('#dataGrid').datagrid("getRows"); // 这段代码是// 对某个单元格赋值
var changeRows = "";
var beichangeRows ="";
if(index == 0){
beichangeRows = 2;
changeRows = 1;
}else{
changeRows = rows[index-1].priority;
beichangeRows = priority;
}
//进入后台更新优先级
updatePriority(rows[index].id+"@"+changeRows,rows[index-1].id+"@"+beichangeRows);
} function movedown(value, index,row) {
var len = value.length;
var $tr = $(value).parents("tr");
if ($tr.index() != len - 1) {
$tr.fadeOut().fadeIn();
$tr.next().after($tr);
}
var columns = $('#dataGrid').datagrid("options").columns;
// 得到rows对象
var rows = $('#dataGrid').datagrid("getRows"); // 这段代码是// 对某个单元格赋值
var changeRows = "";
var beichangeRows ="";
if(index == len - 1){
beichangeRows =rows[index].priority;
changeRows = rows[index+1].priority;;
updatePriority(rows[index].id+"@"+changeRows,rows[index+1].id+"@"+beichangeRows);
}
} /**
* 更新优先级
* @param changeRows
* @param beichangeRows
*/
function updatePriority(changeRows,beichangeRows){
$.ajax({
url: '../productConfig/updatePriority',
data: {"changeRows":changeRows,"beichangeRows":beichangeRows},
type: 'post',
dataType: 'json',
success: function(r) {
$('#dataGrid').datagrid("reolad")
}
});
}
最新文章
- 【原创】自己动手写工具----XSmartNote [Beta 2.0]
- 微信开发笔记:公众号获取access_token
- php配置中的register_globals用法
- [转] C#中的Dictionary的使用
- Windows下使用Visual Studio 2010编译ffmpeg全过程
- android studio引入第三方包记录
- 同样的一句SQL语句在pl/sql 代码块中count 没有数据,但是直接用SQl 执行却可以count 得到结果
- struts2设置<;s:select>;默认选中项的方法
- HDFS笔记——技术点汇总
- border-image详解
- xapp1151_Param_CAM模块安装
- web报表工具FineReport常用函数的用法总结(文本函数)
- rest_framework中视图相关
- bash 调试
- 10、java5线程池之返回结果的任务之Callable与Future
- Process和Thread在指定CPU运行
- python nose测试框架全面介绍八---接口测试中非法参数的断言
- java基础解析系列(六)---注解原理及使用
- Linux基础命令---gunzip
- 看黑客如何远程黑掉一辆汽车 - BlackHat 2015 黑帽大会总结 day 1