zoukankan      html  css  js  c++  java
  • jqgrid 编辑表格(包含下拉框)

    1.1在jqgrid 按钮
      <asp:JQGridColumn TextAlign="Center" Width="150" DataField="act" Visible="True" HeaderText="编辑"></asp:JQGridColumn>
    1.2
     在jqgrid的客户端事件中绑定如下方法
    
    function gridComplete() {
    var ids = jQuery("#jq2").jqGrid('getDataIDs');
    for (var i = 0; i < ids.length; i++) {
    var id = ids[i];
    be = "<input style='height:22px;60px;' type='button' class='button' iconcls='icon-edit' value='编辑' onclick="editRow('"
    + id + "'," + true + ");" id=btn_" + id + " />";
    se = "<input style='height:22px;60px;' type='button' value='保存' iconcls='icon-save' onclick="saveRow('"
    + id + "');" />";
    //ce = "<input style='height:22px;60px;' type='button' value='恢复' iconcls='icon-cancel' onclick="jQuery('#jq2').restoreRow('"
    // + id + "');" />";
    jQuery("#jq2").jqGrid('setRowData', ids[i],
    {
    act: be + se
    });
    }
    }
    
    function editRow(id) {
    jQuery('#jq2').editRow(id, true);
    $("#btn_" + id).attr("disabled", true);
    }
    
    function saveRow(id) {
    jQuery("#jq2").jqGrid('saveRow', id);
    $("#btn_" + id).attr("disabled", false);
    // $("#jq2").saveRow(id);
    
    //112801:加上;112802:乘上;112803:减去
    // $("#jq2").jqGrid("setGridParam", { page: 1 }).trigger("reloadGrid");
    }
    
    2.把EditType:DropDown
    <asp:JQGridColumn DataField="ShockValueType" Visible="true" HeaderText="绝对值或百分比" EditType="DropDown" Editable="true">
    <Formatter>
    <asp:CustomFormatter FormatFunction="InstrumentChangeType" />
    </Formatter>
    </asp:JQGridColumn>
    
    3.在后台绑定EditValues
    
    public void BindEditValues()
    {
    QueryInfo ShockModelInfo = new QueryInfo("SysEnumDic");
    ShockModelInfo.AddParam("ParentCode", "Shock_Mode");
    var shockModels = Holworth.Utility.HraUtility.ListToT<SysEnumDic>(Dao.FindList(ShockModelInfo)).ToList();
    var shockModelStr = "";
    shockModels.ForEach(s =>
    {
    shockModelStr += (int)s.EnumValue + ":" + s.EnumName + ";";
    });
    shockModelStr = shockModelStr.TrimEnd(';');
    jq2.Columns[3].EditValues = shockModelStr;
    }
  • 相关阅读:
    Puppet部署
    ldap命令
    openldap slapd.conf参数
    ldap objectclass
    ldap 测试表设计
    Nginx/LVS/HAProxy负载均衡软件的优缺点
    SNAT DNAT MASQUERADE 区别
    iptables常用规则
    Python中文注释报错的解决方法
    用Node.js给邮箱发送邮件
  • 原文地址:https://www.cnblogs.com/kexb/p/5162714.html
Copyright © 2011-2022 走看看