EASYUI- EASYUI左移右移 GRID中值

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)