先看列
<cc1:JQGridColumn Visible="false" Editable="true" DataType="String" Searchable="true" SearchToolBarOperation="IsEqualTo" HeaderText="入库单编号" DataField="inStoreCode"> <Formatter> <cc1:CustomFormatter FormatFunction="doShowInStoreInfo" UnFormatFunction="unformatCode" /> </Formatter> </cc1:JQGridColumn>
//显示入库单信息 function doShowInStoreInfo(cellValue, options, rowObject) { var vPageParam = "inStoreId=" + rowObject[3] + "&inStoreCode=" + cellValue; var strURL = "./_view.aspx?" + vPageParam; var imageHtml = "<a target='_blank' style='color:Blue; text-decoration:nonde;' href='" + strURL + "'>" + cellValue + "</a>"; return imageHtml; }
List<string> Itemlist = new List<string>(); if (_hidListColumns.Value == "") { if (Jqgrid1.Columns.Count != 0) { for (int i = 0; i < Jqgrid1.Columns.Count; i++) { var newObj = new { Item = i, ColumnsName = Jqgrid1.Columns[i].DataField }; string serExpr = JavaScriptConvert.SerializeObject(newObj); Itemlist.Add(serExpr); } var listColumns = new { Itemlist = Itemlist }; _hidListColumns.Value = JavaScriptConvert.SerializeObject(listColumns); } }
前台接受
function getColumnindex(name) { var ListColumns = document.getElementById("_hidListColumns").value; eval("var ListColumns=" + ListColumns); if (ListColumns!="") { for (var i = 0; i < ListColumns.Itemlist.length; i++) { eval("var Items=" + ListColumns.Itemlist[i]); if (Items.ColumnsName == name) { return Items.Item; } } } }
//显示入库单信息 function doShowInStoreInfo(cellValue, options, rowObject) { var vPageParam = "inStoreId=" + rowObject[getColumnindex("id")] + "&inStoreCode=" + cellValue; var strURL = "./_view.aspx?" + vPageParam; var imageHtml = "<a target='_blank' style='color:Blue; text-decoration:nonde;' href='" + strURL + "'>" + cellValue + "</a>"; return imageHtml; }