json 存 window.localStorage.setItem('hideColums',hideArr);

onColumnSwitch:function(row, $element){
//JSON.parse()
var showColumns=$('#table').bootstrapTable('getVisibleColumns');
var showArr = [];
$.each(showColumns,function(index,data){
showArr.push(data.field);
});
window.localStorage.setItem('showColums',showArr);
var hideColumns=$('#table').bootstrapTable('getHiddenColumns');
var hideArr = [];
$.each(hideColumns,function(index,data){
hideArr.push(data.field);
});
window.localStorage.setItem('hideColums',hideArr);
//$('#table').colResizable({ disable: true }).colResizable({ liveDrag: true, gripInnerHtml: "<div class='grip'></div>", draggingClass: "dragging" });
} ,




--------------------------

存json的代码

var jsonObj = {"a":true};
window.localStorage.setItem("kkk",JSON.stringify(jsonObj));

 

取json的代码

var getkkk = JSON.parse(window.localStorage.getItem("kkk"));


console.info(JSON.parse(getkkk).a);
console.info(window.localStorage.getItem("kkjj"));
console.info(window.localStorage);
console.info(JSON);

---------------------------------------------

 

var tableColShow =
{
"id1":{
"field":"a01.a0101"
,"hide":"false"
,"txt":"姓名"
}
}

window.localStorage.setItem("zaizhiganbu",JSON.stringify(tableColShow));
var zaizhiganbu = JSON.parse(window.localStorage.getItem("zaizhiganbu"));
console.info(zaizhiganbu["id1"]["field"]);

posted @ 2018-10-15 17:37  彭成刚  阅读(385)  评论(0编辑  收藏  举报