JQgrid Multiselect与eric hynds multiselect冲突

时间:2013-03-19 12:25:52

标签: jquery jqgrid multi-select

在我的下面提到的演示中,它显示了jqgrid使用multiselect插件和eric hynds multiselect插件之间的冲突。 我想要的是让eric hynds插入jqgrid旁边的组合框,并且jqgrid multiselect应该是原样。 但是,由于演示显示jqgrid multiselect被覆盖,并且在列选择器中也有eric hynds multiselect存在。

enter code here
    <html>

<head>

<link rel="stylesheet" type="text/css" media="screen" href="css/cyberoam.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery/jquery-ui-1.8.22.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery/jqgrid/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery/jquery.ui.datepicker.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery/ui.multiselect.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery/jquery-ui-timepicker-addon.css" />

<script src="javascript/jquery/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="javascript/jquery/jquery.ui.widget.js" type="text/javascript"></script>
<script src="javascript/jquery/jqgrid/ui.multiselect.js" type="text/javascript"></script>
<script src="javascript/jquery/grid.locale-en.js" type="text/javascript"></script>
<script src="javascript/jquery/jqgrid/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="javascript/jquery/jquery.ui.datepicker.js" type="text/javascript"></script>
<script src="javascript/jquery/jquery-ui-1.8.21.custom.min.js" language="javascript"></script>
<script src="javascript/jquery/jqgrid/jqgrid.general.js" type="text/javascript"></script>
<script src="javascript/jquery/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<script src="javascript/ajax.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/common.css" type="text/css" />


<link rel="stylesheet" type="text/css" href="css/jquery/jquery.multiselect.css" />
    <script type="text/javascript" src="javascript/jquery/jquery.multiselect.js"></script>
    <link rel="stylesheet" type="text/css" href="css/jquery/jquery.multiselect.filter.css" />
    <script type="text/javascript" src="javascript/jquery/jquery.multiselect.filter.js"></script>


</head>
<script type="text/javascript">
jQuery(function(){

  //jQuery.localise('ui-multiselect', {/*language: 'en',*/ path: 'js/locale/'});
            jQuery(".multiselect").multiselect({selectedList:10});
            //jQuery('#switcher').themeswitcher();
});
 jQuery(document).ready(function() {


var myData = [
                    { orderID: "10", orderDate: "2010-09-18", shipmentDate: "2010-09-20", orderStatus: "2" },
                    { orderID: "15", orderDate: "2010-09-20", shipmentDate: "2010-09-24", orderStatus: "3" },
                    { orderID: "30", orderDate: "2010-08-28", shipmentDate: "2010-09-01", orderStatus: "4" },
                    { orderID: "20", orderDate: "2010-10-16", shipmentDate: "2010-10-17", orderStatus: "1" }
                ], i, l, myRow, orderStatus;


            var grid = jQuery('#list');
            grid.jqGrid({
                data: myData,
                datatype: 'local',
                caption: 'Order Details',
                height: 'auto',
                gridview: true,
                headertitles: true,
                viewrecords: true,
                pager: '#pager',

                rownumbers: true,
                colNames: ['Order ID', 'Order', 'Shipment', 'Pending', 'Processing', 'Delivered', 'Order Status'],
                colModel: [
                    { name: 'orderID', index: 'orderID', key:true, width: 120, sorttype: 'int' },
                    { name: 'orderDate', index: 'orderDate', width: 180,
                      sorttype: 'date', formatter: 'date' },
                    { name: 'shipmentDate', index: 'shipmentDate', width: 180,
                      sorttype: 'date', formatter: 'date' },
                    { name: 'pending', width: 21, index: 'pending', formatter: 'checkbox', align: 'center',
                      stype: "select", searchoptions: { value: "1:Yes;0:No" } },
                    { name: 'processing', width: 21, index: 'processing', formatter: 'checkbox', align: 'center',
                      stype: "select", searchoptions: { value: "1:Yes;0:No" } },
                    { name: 'delivered', width: 21, index: 'delivered', formatter: 'checkbox', align: 'center',
                      stype: 'select', searchoptions: { value: "1:Yes;0:No" } },
                    { name: 'orderStatus', index: 'orderStatus', width: 50, hidden: true }
                ]
            }).jqGrid ('navGrid', '#pager', { edit: false, add: false, del: false, refresh: true, view: false },
                        {},{},{},{multipleSearch:true,recreateFilter:true})
              .jqGrid ('navButtonAdd', '#pager', { caption: "", buttonicon: "ui-icon-calculator", title: "choose columns",
                  onClickButton: function() {
                      grid.jqGrid('columnChooser');
                  }
              });
});
</script>
<body>
<select id="countries" class="multiselect" multiple="multiple" name="countries[]">
  <option value="AFG">Afghanistan</option>
  <option value="ALB">Albania</option>
  <option value="DZA">Algeria</option>
  <option value="AND">Andorra</option>
  <option value="ARG">Argentina</option>
  <option value="ARM">Armenia</option>
  <option value="ABW">Aruba</option>
  <option value="AUS">Australia</option>
  <option value="AUT" selected="selected">Austria</option>

</select>

<div style="float:left">
        <table id="list"><tbody><tr><td/></tr></tbody></table>
        <div id="pager"></div>
    </div>

</body>
</html>

2 个答案:

答案 0 :(得分:0)

因此,jqGrid可能正在使用multiselect类 - 如果是这样,那么只需更改代码即可使用其他类。像这样:

jQuery(".ericmultiselect").multiselect({selectedList:10});

<select id="countries" class="ericmultiselect" multiple="multiple" name="countries[]">
....

然后它不会与jqGrid使用的任何内容发生冲突。

答案 1 :(得分:0)

这真的很晚,但是如果有人用谷歌搜索。

您想进入jquery.multiselect.js

查找此行:

$.widget("ech.multiselect", {

并将小部件/插件名称更改为类似

$.widget("ech.multiselectdifferentname", {

现在,您必须找到在代码中调用multiselect的位置。对于上述示例,

jQuery(".multiselect").multiselect({selectedList:10});

因此您将其更改为

jQuery(".multiselect").multiselectdifferentname({selectedList:10});

这样做的原因是因为您已经在使用ui.multiselect.js,它是jquery.ui多选。这就是控制columnChooser选择框的内容。这与使用相同名称的Eric Hynds multiselect插件冲突。