亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    layui數(shù)據(jù)表格隱藏列的方法介紹

    layui數(shù)據(jù)表格隱藏列的方法介紹

    在使用layui做數(shù)據(jù)表格的時(shí)候,插入的數(shù)據(jù)的id是不是一組連續(xù)的數(shù)字,那么就需要用到layui的cols的type屬性。

    layui數(shù)據(jù)表格隱藏列的方法介紹

     table.render({     elem: '#test'     ,url:'${pageContext.request.contextPath}/findcustomers'     ,cols: [[       {align:'center', title: '編號(hào)', sort: true,type:'numbers',width:100}     ]]     ,page: true   });

    我們就會(huì)獲得一列有序的數(shù)列(ps:這里的必須加width屬性,使用minWidth沒有用,如果沒用width,那么會(huì)使用layui的表格默認(rèn)寬度40)

    layui數(shù)據(jù)表格隱藏列的方法介紹

    那么問題來了,我們的id怎么獲取呢,難道id再開一列嗎,如果id有意義,那么再開一列是可以的,如果沒有意義但有需要用的話,那么把id隱藏起來更為美觀。在layui2.4版本以前我們可以用layui的數(shù)據(jù)表格的done參數(shù)。

    layui數(shù)據(jù)表格隱藏列的方法介紹

      table.render({     elem: '#test'     ,url:'${pageContext.request.contextPath}/findcustomers'     ,cols: [[       {align:'center', title: '編號(hào)', sort: true,type:'numbers',width:100}       ,{field:'cust_id', title: 'ID'}       ]]      ,done:function(res,curr,count){ // 隱藏列            $(".layui-table-box").find("[data-field='cust_id']").css("display","none");            }     ,page: true   });

    可以將id隱藏,但有那么零點(diǎn)幾秒,id的列是加載出來了,最后隱藏的。那么有沒有更有效的辦法呢,只能layui自己在加載的時(shí)候,實(shí)現(xiàn)隱藏。所以在layui2.4版本的時(shí)候,layui的cols的參數(shù)新添了hide(隱藏)屬性。

    layui數(shù)據(jù)表格隱藏列的方法介紹

      table.render({     elem: '#test'     ,url:'${pageContext.request.contextPath}/findcustomers'     ,cols: [[       {align:'center', title: '編號(hào)', sort: true,type:'numbers',width:100}       ,{field:'cust_id', title: 'ID', hide:true}       ]]     ,page: true   });

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)