⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grid.tbltogrid-min.js

📁 news新闻系统. news新闻系统 news新闻系统
💻 JS
字号:
/*
 Transform a table to a jqGrid.
 Peter Romianowski <peter.romianowski@optivo.de> 
*/
function tableToGrid(p){$(p).each(function(){if(this.grid){return}$(this).width("99%");var q=$(this).width();var l=$('input[type=checkbox]:first',$(this));var m=$('input[type=radio]:first',$(this));var f=l.length>0;var r=!f&&m.length>0;var n=f||r;var s=l.attr("name")||m.attr("name");var c=[];var g=[];$('th',$(this)).each(function(){if(c.length==0&&n){c.push({name:'__selection__',index:'__selection__',width:0,hidden:true});g.push('__selection__')}else{c.push({name:$(this).html(),index:$(this).html(),width:$(this).width()||150});g.push($(this).html())}});var d=[];var h=[];var i=[];$('tbody > tr',$(this)).each(function(){var j={};var e=0;d.push(j);$('td',$(this)).each(function(){if(e==0&&n){var k=$('input',$(this));var o=k.attr("value");h.push(o||d.length);if(k.attr("checked")){i.push(o)}j[c[e].name]=k.attr("value")}else{j[c[e].name]=$(this).html()}e++})});$(this).empty();$(this).addClass("scroll");$(this).jqGrid({datatype:"local",width:q,colNames:g,colModel:c,multiselect:f});for(var a=0;a<d.length;a++){var b=null;if(h.length>0){b=h[a];if(b&&b.replace){b=encodeURIComponent(b).replace(/[.\-%]/g,"_")}}if(b==null){b=a+1}$(this).addRowData(b,d[a])}for(var a=0;a<i.length;a++){$(this).setSelection(i[a])}})};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -