/*資源表格接口*/node
var dataTableHeader=function(elem,unSorts,defaultSort,screens,status,toggleVis,ipAddress,stateSave,model,columnTitle,unOrderFlag,unPagingInfo){api
resTableRadioRow=[];cookie
//elem目標元素選擇器dom
//unSorts無排序功能列,以Arry格式傳入列索引函數
//defaultSort默認降序排序列this
//screens枚舉列索引排序
//status枚舉內容,這個是表格列中要有索引
//toggleVis須要進行顯示隱藏的列接口
//ipAddress須要進行排序的ip地址,列索引,eg:[1,2]ip
//model模態框中列表每頁顯示的5條數據
//columnTitle表格列添加title
//unOrderFlag表格不開啓排序標識
//unPagingInfo表格無分頁信息標識
var keyName='DataTables_'+elem.replace(/#|\./g,"")+'-'+window.location.pathname;
if(keyname && !(stateSave && stateSave===true){
localStore.removeItem(keyName);
}
var table=$(elem).DataTable({
stateSave:true,
destroy:true,
ordering:(function(){//是否開啓排序功能
if(unOrderFlag){
return false;
}
})();
paging:(function(){
if(unPagingInfo){
return false;
}else{
return true;
}
})(),
dom:(function(){//是否有分頁信息
if(unPagingInfo){
return "t<'bottom clearfix cloudos-table-tfoot'>";
}else{
return "t<'bottom clearfix cloudos-table-tfoot'lip>";
}
})();
createdRow:function(row,data,dataIndex){//當tr元素被建立(全部td內容已經被插入)該回調函數被執行
resTableRadioRow.push(row);
},
initComplete:function(settings){
var useId=getCookie("useId");,
api=this.api(),
tdCollection=api.columns(columnTitle).nodes();
for(var i=0;i<j<tdCollection.length;i++){
for(var j=0;j<tdCollection[i].length;j++){
if(!$(tdCollection[i][j].hasClass("cloudos-operate")){
$(tdCollection[i][j]).attr("title",$.trim($(tdCollection[i][j]).text()).replace(/[ ]/g,"").replace(/[\r\n]/g,""))
}
}
}
function getCookie(cookie_name){//獲取用戶id
var allcookies=document.cookie,
cookie_pos=allcookies.indexOf(cookie_name);//索引長度
if(cookie_pos!=-1){
//把cookie_pos放在值的開始,只要給值加1便可
cookie_pos+=cookie_name.length+1;
var cookie_end=allcookies.indexOf(":",cookie_pos);
if(cookie_end==-1){
cookie_end=allcookies.length;
}
var value=unescape(allcookies.substring(cookie_pos,cookie_end));
}
return value;
}