码迷,mamicode.com
首页 > 其他好文 > 详细

EASYUI- EASYUI左移右移 GRID中值

时间:2015-07-18 15:25:13      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:

EASYUI左移右移 GRID中值

$("#addAll").click(function(){
    var ids = [];
    var names = [];
    var srcrows = $(‘#sourceTable‘).datagrid(‘getSelections‘);
    if(srcrows.length == 0 ){
        Sys.InfoShow("请选择要移动的记录!");
        return;
    }
    var id;var name;

    for(var srci=srcrows.length-1;srci>=0;srci--){
    
        id = srcrows[srci].termac;
        name = srcrows[srci].tername;
        names.push(srcrows[srci].tername);
        ids.push(srcrows[srci].termac);
        
        var index = $(‘#sourceTable‘).datagrid(‘getRowIndex‘, srcrows[srci]);
        $(‘#sourceTable‘).datagrid(‘deleteRow‘, index);
        $(‘#targetTable‘).datagrid(‘appendRow‘,{‘termac‘:id,‘tername‘:name});
    
  
    }

});
       
$("#disAll").click(function(){
    var ids_tag = [];
    var names_tag = [];
    var tagrows = $(‘#targetTable‘).datagrid(‘getSelections‘);
    if(tagrows.length == 0 ){
        Sys.InfoShow("请选择要移动的记录!");
        return;
    }
    var id_tag,name_tag;
    for(var i=tagrows.length-1;i>=0;i--){
        id_tag = tagrows[i].termac;
        name_tag = tagrows[i].tername;
        names_tag.push(tagrows[i].tername);
        ids_tag.push(tagrows[i].termac);
        var index = $(‘#targetTable‘).datagrid(‘getRowIndex‘, tagrows[i]);
        $("#targetTable").datagrid(‘deleteRow‘,index);
        $(‘#sourceTable‘).datagrid(‘appendRow‘,{‘termac‘:id_tag,‘tername‘:name_tag});
    }    
})

 

EASYUI- EASYUI左移右移 GRID中值

标签:

原文地址:http://www.cnblogs.com/cxeye/p/4656802.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!