jqgrid 편집 표 (아래 상자 포함)

4798 단어
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;width:60px;' type='button' class='button' iconcls='icon-edit' value='  ' onclick=\"editRow('"
+ id + "'," + true + ");\" id=btn_" + id + " />";
se = "<input style='height:22px;width:60px;' type='button' value='  ' iconcls='icon-save' onclick=\"saveRow('"
+ id + "');\" />";
//ce = "<input style='height:22px;width: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;
}

좋은 웹페이지 즐겨찾기