ASP.NET-FineUI開發實踐-5

來源:互聯網
上載者:User

標籤:blog   http   io   ar   資料   sp   div   2014   on   

1.tree的右鍵事件和單擊事件

頁面就不寫了,準備一個樹和一個菜單控制項,隨便寫點啥

JS:注意注釋

var menuSettings = F(‘menuSettings‘);            var tree = F(IDS.tree);            //右鍵事件itemcontextmenuthis:view;record:屬於選項的記錄;item:選項元素;index:選項索引e:事件對象            tree.on(‘itemcontextmenu‘, function (view, record, item, index, event) {                //判斷子節點(重要)                if (record.isLeaf()) {                    //阻止原右鍵事件                    event.stopEvent();                    //菜單顯示位置,即滑鼠點擊位置                    menuSettings.showAt(event.getPoint());                }            });            //左鍵事件itemclick:參數一樣            tree.on(‘itemclick‘, function (view, record, item, index, event) {                //判斷子節點(重要)                if (record.isLeaf()) {                    //阻止原左鍵事件                    event.stopEvent();                    //參數擷取url,text,icon,ShowWindow是執行的方法                    ShowWindow(record.data.href, record.data.text, record.data.icon, record.data.icon);                }            });            //右鍵菜單出現後按鈕點擊的事件            F(‘<%= btnAdd.ClientID %>‘).on(‘click‘, function () {                //得到tree                var tree = F(IDS.tree);                //得到tree資料,選項,Array.each在數組中定位,最後返回資料                var record = tree.getSelectionModel();                var selection = record.getSelection();                var rdata;                Ext.Array.each(selection, function (record, index) {                    rdata = record;                });                //獲得右鍵對應的項的資訊(url,icon,text)                Addlinks(rdata.data.href, rdata.data.icon, rdata.data.text, rdata.data.icon);            });

  

2.Panel右鍵效果

一個panel一個tree

 var menu1 = F(‘<%= menu1.ClientID %>‘);            //panel的右鍵事件注意el,e:事件,t:元素            F(‘Panel1‘).el.on(‘contextmenu‘, function (e, t) {                //阻止事件                e.stopEvent();                //菜單顯示位置                menu1.showAt(e.getPoint());            });            //Panel1裡有個標題列,不用右鍵            F(‘<%= Toolbar1.ClientID %>‘).el.on(‘contextmenu‘, function (e, t) {                //直接阻止了                e.stopEvent();            });

  

ASP.NET-FineUI開發實踐-5

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.