easyUI使用

使用1. 變色

情景描述:datagrid顯示的數據添加自定義列“操作”,要實現“操作”後讓這行變色

    如果使用datagrid的rowStyler,必須要有個filed的條件,當條件滿足時這行變色,但是我這裏“操作”後真是沒有條件沒有任何標誌

    解決辦法是添加隱藏的自定義列,field在後臺賦值,由於我這裏是兩個表,審覈後的數據放到另一個表中,所以我要比較原始表和審覈表的數據,

若審覈表中已存在,則設置IsCheck的值爲1,然後前端用rowStyler實現變色

        { field: 'IsCheck', title: '是否已審覈', width: 100, hidden: true }


使用2:佈局

情景描述:layout佈局採用全屏的東西南北中佈局,中間顯示主要內容

    要想實現全屏,必須將<body class="easyui-layout">這句設置上,我的頁面使用的是easyui的demo頁面full.html

<body class="easyui-layout">
    <div data-options="region:'north',border:false" style="height:60px;background:#B3DFDA;padding:10px">
    </div>
    <div data-options="region:'west',split:true,title:'West'" style="width:150px;padding:10px;">west content</div>
    <div data-options="region:'east',split:true,collapsed:true,title:'East'" style="width:100px;padding:10px;">east region</div>
    <div data-options="region:'south',border:false" style="height:50px;background:#A9FACD;padding:10px;">south region</div>
    <div data-options="region:'center',title:'Center'">        
    </table>
    </div>
</body>

   其中west部分放菜單,center部分放iframe(設置如下),iframe顯示菜單的鏈接內容,此時要讓鏈接頁面的內容在iframe中全屏顯示,

<iframe id="frame_content" name="show" frameborder="no" border="0" marginwidth="0" marginheight="0"
                style="display: block;" allowtransparency="true" scrolling="no" width="100%"
                height="100%"></iframe>

嵌套的頁面也要<body class="easyui-layout">這樣設置,可以在裏面使用easyui-tabs,要設置fit:true。

注意:iframe的height雖然設置爲100%,但會顯示滾動條,單純的加overflow:true是沒用的,原因是iframe是行內元素,因此會有line-height造成iframe下面有空白,

所以使用*{line-height: 0;}可以解決問題


使用3:若想在表格中顯示多個複選框選項(如下圖),藉助於formatter



後臺返回的是list轉換成的json,到前端解析一下,遍歷,其中checked是list中保存的對象的一個屬性。


沒貼多少代碼,主要是因爲功能穿插的有些凌亂,只是說一下思想。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章