【问题标题】:Cannot read property 'oFeatures' of undefined datatables无法读取未定义数据表的属性“oFeatures”
【发布时间】:2016-07-25 14:54:04
【问题描述】:

我收到此错误无法读取未定义数据表的属性“oFeatures”我正在使用数据表编辑器的气泡编辑

<script type="text/javascript">
var editor;
$(document).ready(function(){
 // use a global for the submit and return data rendering in the examples
 

    editor = new $.fn.dataTable.Editor( {
    ajax: 'http://52.77.155.163/web/index.php?r=ivision/productprices/datatable',

        table: '#example',
        
        fields: [ {
                label: "Id:",
                name: "id"
            }, 
            
        ],
        formOptions: {
            inline: {
                onBlur: 'submit'
            }
        }
    } );

    
$('#example').on( 'click', 'tbody td', function (e) {
        var index = $(this).index();
 
        if ( index === 0 ) {
            editor.bubble( this );
        }
});

var table=$('#example').DataTable( {
        ajax: 'http://52.77.155.163/web/index.php?r=ivision/productprices/datatable',
        dom: "Bfrtip",
        scrollY: 300,
        paging: false,
        bSort: false,
        columns: [
            { data: "id" },
            { data: "getcat(cat_id)" },
            { data: "getproduct(p_id)" },
            { data: "m_price" },
            { data: "c_price" },
            { data: "e_price" },
            
            {
                data: null,
                defaultContent: '<a href="#" class="remove">Delete</a>',
                orderable: false
            }],
            buttons: [
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            { extend: "remove", editor: editor }
        
        ],

    } );




});	



</script>

我在控制台中收到此错误,Cannot read property 'oFeatures' of undefined 。我正在为 datatables.net 编辑器使用气泡编辑。

【问题讨论】:

标签: datatables jquery-datatables-editor


【解决方案1】:

我也收到此错误。

这是问题所在,Editor 的表属性是不同的 DataTable Id。

使用相同的Id后,它是固定的。

【讨论】:

  • 工作就像一个魅力?还记得在创建数据表时使用 API 实例 => $('#table').DataTable({ 而不是使用这样的对象 => $('#table').dataTable({
猜你喜欢
  • 2022-01-18
  • 1970-01-01
  • 2017-03-14
  • 2020-06-21
  • 2021-09-12
  • 1970-01-01
相关资源
最近更新 更多