if (0 < b.columnModel.length) {
b.colNames = [];
b.colModel = [];
c = 0;
for (var r; c < b.columnModel.length; c++) {
r = b.columnModel[c];
r.header ? b.colNames.push(r.header) : r.label && b.colNames.push(r.label);
if (b.treeGrid || !b.sortableColumn) {
//优化排序功能
if (r.sortable === undefined) {
r.sortable = !1;
}
}
b.colModel.push(r)
}
}
//优化排序功能
/*
if (b.treeGrid || !b.sortableColumn) for (c = 0; c < b.colModel.length; c++) b.colModel[c].sortable = !1;
*/
修复ie8下搜索框错位
//重新调整ie8下文本框和标签的长度
if (checkDeviceK().ie !== false && checkDeviceK().ie < 9) {
$('div[class=form-group]').each(function () {
var initWidth = $(this).width();
var labels = $(this).children('label');
$(this).width(initWidth + getChildrenLabelTotalWidth(labels) + 2)
});
}
/**
* 获取元素所有资源色的长度之和
* @param object
* @returns {number}
*/
function getChildrenLabelTotalWidth(object) {
var totalWidth = 0;
object.each(function () {
totalWidth = totalWidth + $(this).width();
});
return totalWidth;
}
/**
* 返回设备信息 os和ie和weixin;checkDeviceK.ie
* @param doc
*/
function checkDeviceK(doc) {
var n = navigator.userAgent.toLowerCase(), r = function (e) {
var doc = new RegExp(e + "/([^\\s\\_\\-]+)");
return e = (n.match(doc) || [])[1], e || !1
}, o = {
os: function () {
return /windows/.test(n) ? "windows" : /linux/.test(n) ? "linux" : /iphone|ipod|ipad|ios/.test(n) ? "ios" : /mac/.test(n) ? "mac" : void 0
}(), ie: function () {
return !!(window.ActiveXObject || "ActiveXObject" in window) && ((n.match(/msie\s(\d+)/) || [])[1] || "11")
}(), weixin: r("micromessenger")
};
return doc && !o[doc] && (o[doc] = r(doc)), o.android = /android/.test(n), o.ios = "ios" === o.os, o.mobile = !(!o.android && !o.ios), o
}
优化表格高度
//优化表格高度
function n() {
if (b.autoGridHeight) {
if ("function" == typeof b.autoGridHeight) var c = b.autoGridHeight(); else {
c = a(g).height();
var z = a(g).parent();
var ss = a(g).parent().parent().parent().parent().parent().height() + 2;
//alert(a("body").height());
0 != z.length && (c = z.height());
c = a(window).height() - /*a("body").height()*/ss + c - b.autoGridHeightFix;
200 > c && (c = 200);
z.height(c);
}
0 != c && g.jqGrid("setGridHeight", c)
}
}