最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

使用contextMenu插件實(shí)現(xiàn)Bootstrap table彈出右鍵菜單

 更新時(shí)間:2017年02月20日 09:24:59   投稿:mrr  
如今Bootstrap這個(gè)前端框架已被許多人接受并應(yīng)用在不同的項(xiàng)目中,其中“開發(fā)高效,設(shè)備兼容”的特點(diǎn)表現(xiàn)得非常明顯。這篇文章主要介紹了使用contextMenu插件實(shí)現(xiàn)Bootstrap table彈出右鍵菜單,需要的朋友可以參考下

如今Bootstrap這個(gè)前端框架已被許多人接受并應(yīng)用在不同的項(xiàng)目中,其中“開發(fā)高效,設(shè)備兼容”的特點(diǎn)表現(xiàn)得非常明顯。再加上它默認(rèn)的美觀的UI組件,簡直就是很多前端的大愛?。。?! 今天在這里跟大家分享Bootstrap table彈出右鍵菜單的實(shí)現(xiàn)方法。

最近遇到有一個(gè)需求,需要在Bootstrap table上使用右鍵。網(wǎng)上搜了半天沒有找到,最后發(fā)現(xiàn)Bootstrap table不支持右鍵(官方文檔給出的答案 https://github.com/wenzhixin/bootstrap-table/issues/241 )。

本文介紹使用contextMenu插件實(shí)現(xiàn)Bootstrap table右鍵功能。

代碼(test.html):

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="libs/bootstrap-table-v1.11.0/bootstrap.min.css" rel="external nofollow" >
<link rel="stylesheet" href="libs/bootstrap-table-v1.11.0/bootstrap-table.css" rel="external nofollow" >
<link href="libs/jQuery-contextMenu/dist/jquery.contextMenu.css" rel="external nofollow" rel="stylesheet"/>
<script src="libs/jQuery/jquery-1.8.3.min.js"></script>
<script src="libs/bootstrap-table-v1.11.0/bootstrap.min.js"></script>
<script src="libs/bootstrap-table-v1.11.0/bootstrap-table.js"></script>
<script src="libs/bootstrap-table-v1.11.0/bootstrap-table-zh-CN.js"></script>
<script src="libs/jQuery-contextMenu/dist/jquery.contextMenu.js"></script>
</head>
<body>
<table id="item_table"></table>
<script>
$('#item_table').bootstrapTable({
 columns: [{
 field: 'id',
 title: 'Item ID'
 }, {
 field: 'name',
 title: 'Item Name'
 }, {
 field: 'price',
 title: 'Item Price'
 }],
 data: [{
 id: 1,
 name: 'Item 1',
 price: '$1'
 }, {
 id: 2,
 name: 'Item 2',
 price: '$2'
 }]
});
$.contextMenu({
 // define which elements trigger this menu
 selector: "#item_table td",
 // define the elements of the menu
 items: {
 foo: {name: "Foo", callback: function(key, opt){ alert("Foo!"); }},
 bar: {name: "Bar", callback: function(key, opt){ alert("Bar!") }}
 }
 // there's more, have a look at the demos and docs...
});
</script>
</body>
</html>

效果圖:

這里寫圖片描述

關(guān)于contextMenu的使用,可以參考網(wǎng)頁中右鍵功能的實(shí)現(xiàn)— contextMenu的使用 。

關(guān)于Bootstrap table的使用,可以參考官方文檔Bootstrap table。

以上所述是小編給大家介紹的使用contextMenu插件實(shí)現(xiàn)Bootstrap table彈出右鍵菜單,希望對(duì)大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論

福泉市| 绥阳县| 元阳县| 阿克苏市| 湖南省| 五河县| 锦州市| 庄河市| 太白县| 陆丰市| 买车| 北流市| 宁波市| 桑植县| 仪陇县| 苗栗县| 安泽县| 东辽县| 上杭县| 洞头县| 通江县| 勃利县| 楚雄市| 永春县| 九台市| 惠东县| 平顶山市| 静安区| 类乌齐县| 广河县| 灵武市| 高青县| 卢龙县| 南京市| 巴塘县| 台安县| 湖口县| 庐江县| 乌鲁木齐市| 博客| 三台县|