关闭

ligerGrid的使用

11539人阅读 评论(1) 收藏 举报
分类:

加载:

$.post('@Url.Action("defindselect")', {SPName: _productname, SPType: _sptype,ZhiYiTongID:$("#txtZhiYiTong").val() },

             function(json) {

                manager.loadData([]);

                manager.loadData(json);

             }, "json")

 

function GetData() {

$.post('@Url.Action("GetServiceProductJson", "ServiceProduct")', function(json) {

manager = $("#grid1").ligerGrid({

columns: [

{ display: 'SPID', name: 'SPID', id: "spid1", width: 10 },

{ display: '服务产品名称', name: 'SPName', width: 200 },

{ display: '执行城市', name: 'SPEXECity', id: 'SPEXECity', width: 70 },

{ display: '执行城市', name: 'Cn_spexecity', width: 70 },

{ display: '智翼通ID', name: 'ZhiYiTongID', width: 70 },

{ display: '类型', name: 'SPType', width: 50,

render: function (rowdata, rowindex, value) {

var u = "#";

                        if (rowdata.SPType == "01")

                            u = '社保';

                        if (rowdata.SPType == "02")

                            u = '公积金';

                        if (rowdata.SPType == "03")

                            u = '商保';

                        if (rowdata.SPType == "04")

                            u = '招用工';

                        return u;

}

},

{ display: '服务费', name: 'DefaultCost', width: 60 },

{ display: '执行费用', name: 'SPEXECost', width: 60 },

{  display: '操作', name: '111', width: 60,

render: function (rowdata, rowindex, value) {

                        var u = "#";

                        if (rowdata.SPType == "01")

                            u = '<ahref="/SocialCalculate/SetSocialMethod?SPID=' + rowdata.SPID + '">算法定义</a>';

                        if (rowdata.SPType == "02")

                            u = '<ahref="/Fine/index?SPID=' + rowdata.SPID + '&CityCode=' + rowdata.SPEXECity + '">算法定义</a>';

                        if (rowdata.SPType == "03")

                            u = '<ahref="/Business/index?SPID=' + rowdata.SPID + '&CityCode=' + rowdata.SPEXECity + '">算法定义</a>';

                        return u;

                   }

                },

               { display: '启用', name: 'IsUse', width: 60,

                    render: function (rowdata, rowindex, value) {

                        if (rowdata.IsUse == "1")

                            return "已启用"

                        if (rowdata.IsUse == "0")

                            return "没启用"

                   }

               }],

                 enabledEdit: false, rownumbers: true, data: json,

                 width: '100%', height: '100%',

                 onSelectRow: function (data, rowindex, rowobj) {

                    manager_rowindex = rowindex;

                     $("#SPName").val(data.SPName);

                     $("#city").val(data.Cn_spexecity);

                     $('#hid_city').val(data.SPEXECity);

                     $('#ZhiYiTongID').val(data.ZhiYiTongID);

                     $("#comtype").ligerGetComboBoxManager().setValue(data.SPType);

 

                     $("#DefaultCost").val(data.DefaultCost);

                     $("#SPEXECost").val(data.SPEXECost);

 

                     if (data.IsUse == "1") {

                         $("#IsUse").attr("checked", "true");

 

                         isuse = 1;

                         //savemanager.setDisabled();

                         $("#ProductSave").attr("disabled", "false");

                    }

                     else {

                         $("#IsUse").removeAttr("checked");

                         isuse = 0;

                         $("#ProductSave").removeAttr("disabled");

 

                         //$("#ProductSave").attr("disabled","disabled");

                         //savemanager.setEnabled();

                    }

                     $("#hid_spid").val(data.SPID);

                }

             });

            manager.toggleCol("spid1", false); //是否显示该列

             manager.toggleCol("SPEXECity", false);

        }, "json");

     }

 

 

更新行:

var selected = manager.getSelected();

manager.updateRow(selected, {ZhiYiTongID:parseInt($("#ZhiYiTongID").val())}  );

 

 

设置值:

$.post('@Url.Action("save", "ServiceProduct")', { fd: formdata },

function (result) {

manager.set({ data:result });

alert("保存成功!");

//GetData();

}, "json");

 

 

删除值:

if (result.match("删除成功")) {

manager.deleteRow(manager_rowindex);

manager_rowindex= "";  //onSelectRow行选中的时候设置值

}

 

 

重新加载:

manager.loadData([]);

manager.loadData(json);

 

 

获取值:

function getData()

{

//alert(JSON.stringify(manager.getData()));

var items = newArray();

items =manager.getData();

for (var i = 0,l = items.length; i < l; i++) {

alert(items[i].Id +items[i].Title + items[i].MessageContent);

}

}

 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:126248次
    • 积分:1677
    • 等级:
    • 排名:千里之外
    • 原创:52篇
    • 转载:9篇
    • 译文:0篇
    • 评论:4条
    最新评论