【问题标题】:How to add check-box in jquery datatable?如何在 jquery 数据表中添加复选框?
【发布时间】:2014-04-08 11:11:40
【问题描述】:

我正在尝试使用 jquery 数据表添加复选框。 这是我的初始化函数。

initialiseDataTable : function(){
    oTable = $('#example').dataTable({ bJQueryUI: true,
    "bPaginate": false,
   "bInfo": false,
   "bRetrieve":true,
   "sPaginationType": "full_numbers"})
   .makeEditable({
                  sUpdateURL: function(value, settings)
                              {
                                      return(value);
                              },
                              "aoColumns": [

                       {
                           type: 'checkbox',
                       },

                       {   indicator: 'Saving CSS Grade...',
                           tooltip: 'Click to select CSS Grade',
                           loadtext: 'loading...',
                           type: 'select',
                           onblur: 'submit',
                           data: "{'':'Please select...', 'A':'A','B':'B','C':'C'}"  
                       },

                       {  

                       },

                       { 

                       },
                       { 

                       }
       ]
              });

   },

但它给出了一些类型错误 TypeError: $.editable.types[settings.type] 未定义
var plugin = $.editable.types[settings.type].plugin ||函数() { };
这有什么问题?如何添加复选框?

【问题讨论】:

    标签: javascript jquery jquery-plugins datatables jquery-datatables


    【解决方案1】:

    尝试在初始化此类型之前定义您的“复选框”类型

    $.editable.addInputType('checkbox', {
        element: function () {
            var input = $('<input type="checkbox">');
            $(this).append(input);
            return(input);
        },
        content: function (columnValue) {
            /* some actions here */
        }
    });
    

    【讨论】:

      猜你喜欢
      • 2013-02-19
      • 1970-01-01
      • 2020-12-20
      • 1970-01-01
      • 1970-01-01
      • 2018-05-29
      • 1970-01-01
      • 2022-06-16
      • 2012-06-12
      相关资源
      最近更新 更多