📄 treegrid.js
字号:
}
});
linb(arr).removeClass('ui-dirty');
},
showColumn:function(colId, flag){
return this.each(function(profile){
var map=profile.colMap2,
cols=profile.colMap,
col,
sid,
cells,
n=[];
if(col=cols[sid=map[colId]]){
n.push(profile.getSubNode('HCELL',sid).get(0));
_.each(col._cells,function(id){
n.push(profile.getSubNode('CELL',id).get(0));
});
linb(n).css('display',(col.visibility=(flag===false?false:true))?'':'none');
}
});
},
getActiveRow:function(){
var ar,profile=this.get(0);
if(profile.properties.activeMode!='row')return;
if(!(ar=profile.$activeRow))return;
return profile.rowMap[profile.getSubId(ar)];
},
setActiveRow:function(rowId){
var dr, row, profile=this.get(0);
if(profile.properties.activeMode!='row')return;
if(!(row=this.getRowbyRowId(rowId)))return;
if(!(dr=profile.getSubNode('CELLS',row._serialId)).isEmpty())
profile.box._activeRow(profile, dr.get(0).id);
return this;
},
getActiveCell:function(){
var ar,profile=this.get(0);
if(profile.properties.activeMode!='cell')return;
if(!(ar=profile.$activeCell))return;
return profile.cellMap[profile.getSubId(ar)];
},
setActiveCell:function(rowId, colId){
var dr, cell, profile=this.get(0);
if(profile.properties.activeMode!='cell')return;
if(!(cell=this.getCellbyRowCol(rowId, colId)))return;
if(!(dr=profile.getSubNode('CELL',cell._serialId)).isEmpty())
profile.box._activeCell(profile, dr.get(0).id);
return this;
}
},
Initialize:function(){
this.addTemplateKeys(['ALT','PROGRESS']);
},
Static:{
Templates:{
tagName : 'div',
style:'{_style}',
BORDER:{
tagName : 'div',
BOX:{
tagName:'div',
HEADER:{
$order:0,
tagName:'div',
style:"{showHeader}",
//for scroll performance
HI:{
tagName:'div',
style:'width:10000px;',
HCELLS:{
tagName:'div',
style:'{headerHeight};',
/*the first col (row handler) in table header*/
HCELL0:{
$order:0,
style:'{rowHandlerDisplay};width:{_row0DfW}px;',
HCELL0A:{
HHANDLER:{
tagName:'div',
style:'{colDDDisplay}'
},
ROWHANDLER:{
tagName:'div',
style:'{rowDDDisplay}'
}
}
},
OTHERHCELLS:{
$order:1,
tagName:'text',
text:'{header}'
}
}
}
},
SCROLL:{
$order:1,
tagName:'div',
className:'uibg-base ',
BODY:{
tagName:'div',
text:'{rows}'
}
},
FOOTER:{
$order:2
},
COLLIST:{
tagName:'div'
}
}
},
$dynamic : {
/*the other header in table header*/
header:{
HCELL:{
className:'{headerClass}',
style:"width:{width}px;{headerStyle}",
HCELLA:{
text:"{caption}",
SORT:{
style:'{sortDisplay}'
},
HHANDLER : {
$order:2,
tagName:'div',
style:'{colDDDisplay}'
}
}
}
},
rows:{
ROW:{
tagName:'div',
PREVIEW:{
$order:1,
tagName:'div',
style:'{previewDisplay}',
text:'{preview}'
},
CELLS:{
$order:2,
tagName:'div',
className:'{rowCls} {rowClass}',
style:'height:{rowHeight}px;{rowStyle}',
FIRSTCELL:{
$order:0,
style:'{rowHandlerDisplay};width:{_row0DfW}px;',
FIRSTCELLA:{
TOGGLE:{$order:1,
className:'uicmd-toggle2',
style:'{display}'
},
ROWHANDLER:{
tagName:'div',
style:'{rowDDDisplay}'
},
FIRSTCELLNO:{
text:' '
}
}
},
OTHERCELLS:{
tagName:'text',
$order: 1,
text:'{caption}{cells}'
}
},
SUB:{
$order:3,
tagName:'div'
},
SUMMARY:{
$order:4,
tagName:'div',
style:'{summaryDisplay}',
text:'{summary}'
}
}
},
'rows.cells':function(profile,template,v,tag,result){
var me=arguments.callee,map=me._m||(me._m={'checkbox':'.checkbox','button':'.button','progress':'.progress'});
linb.UI.$doTemplate(profile,template,v,tag+(map[v.type]||'.input'),result)
},
'rows.cells.input':{
CELL:{
style:'width:{width}px;{cellDisplay};{cellStyle}',
className:'{cellCls} {cellClass}',
CELLA:{
tagName:'a',
style:'{bgcolor};{color};',
href :linb.$href,
tabindex: '{_tabindex}',
text:"{caption}"
}
}
},
'rows.cells.button':{
CELL:{
style:'width:{width}px;{cellDisplay};{cellStyle}',
className:'{cellCls} {cellClass}',
CELLA:{
tagName:'button',
tabindex: '{_tabindex}',
text:"{caption}"
}
}
},
'rows.cells.checkbox':{
CELL:{
style:'width:{width}px;{cellDisplay};{cellStyle}',
className:'{cellCls} {cellClass}',
CELLA:{
tagName:'a',
href :linb.$href,
tabindex: '{_tabindex}',
CHECKBOX:{
className:'{checkboxCls}'
}
}
}
},
'rows.cells.progress':{
CELL:{
style:'width:{width}px;{cellDisplay};{cellStyle}',
className:'{cellCls} {cellClass}',
CELLA:{
tagName:'a',
href :linb.$href,
tabindex: '{_tabindex}',
PROGRESS:{
tagName:'div',
style:'width:{progress};',
text:'{caption}'
}
}
}
}
}
},
Appearances:{
KEY:{
//in firefox, a can focused with display:block
display:'block',
position:'absolute',
overflow:'hidden'
},
BOX:{
display:'block',
position:'relative',
overflow:'hidden'
},
HEADER:{
background: linb.UI.$bg('head.gif', '#CAE3FF repeat-x left top'),
position:'relative',
overflow:'hidden'
},
HI:{
position:'relative'
},
SCROLL:{
overflow:'auto',
position:'relative'
},
COLLIST:{
position:'absolute',
'z-index':'10',
left:0,
top:0,
cursor:'pointer',
visibility:'hidden',
background: linb.UI.$bg('collist.gif', '#FFF1A0 no-repeat center bottom'),
border:'1px solid',
'border-color': '#fff #ACA899 #ACA899 #fff'
},
BODY:{
overflow:'visible',
position:'absolute',
'background-color':'#fff',
left:0,
top:'0',
'font-size':0,
'line-height':0,
'border-bottom': '1px solid #ACA899'
},
'SORT, SORT-checked':{
width:'16px',
height:'16px'
},
SORT:{
background: linb.UI.$bg('icons.gif', 'no-repeat -110px -220px', true),
position:'absolute',
right:'2px',
bottom:'2px'
},
'HCELL-mouseover SORT':{
$order:1,
'background-position': '-110px -240px'
},
'HCELL-mousedown SORT':{
$order:2,
'background-position': '-110px -260px'
},
'SORT-checked':{
$order:3,
'background-position': '-130px -220px'
},
'HCELL-mouseover SORT-checked':{
$order:4,
'background-position': '-130px -240px'
},
'HCELL-mousedown SORT-checked':{
$order:5,
'background-position': '-130px -260px'
},
HHANDLER:{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -