Tabulator JS:加载数据列后未呈现
Tabulator JS: After loading data column not rendering
在 tabulatorJS 中通过 ajax 加载数据后,header 列标题更改为数据值名称。
ajax 响应是 java object,它与制表符列中的字段名称具有相同的属性名称。
您可以在本文底部看到回复。
Data found
如果未找到数据,则 table 已正确呈现。
No data found
你有什么想法吗?
table = new Tabulator("#table-div", {
ajaxURL: '/loadDataObject.do',
ajaxConfig: 'GET',
ajaxParams: {name: $('#name').val()},
// data: dataObject,
responsiveLayout: true,
keybindings: true,
locale: true,
langs: {
"de-de": {
}
},
movableColumns: true,
movableRows: true,
resizableRows: false,
headerSort: false,
autoColumns: true,
autoResize: true,
layout: 'fitColumns',
placeholder: $.i18n.prop('table.no_data_found'),
columns: [
{rowHandle:true, formatter:"handle", headerSort:false, frozen:true, width:30, minWidth:30, cssClass: 'disabled'},
{title: $.i18n.prop('table.pos_number'), field: 'posNumber', editor: 'input', width: 40},
{title: $.i18n.prop('table.symbol'), field: 'classSymbol', width: 45, cssClass: 'disabled item-symbol'},
{title: $.i18n.prop('table.item_work_operation_number'), field: 'itemNumber', editor: 'input', width: 70, cssClass: 'item-number text-uppercase'},
{title: $.i18n.prop('table.item_work_operation_name'), field: 'itemName', width: 300, cssClass: 'disabled item-name'},
{title: $.i18n.prop('table.item_length'), field: 'itemLength', width: 70, cssClass: 'disabled item-length'},
{title: $.i18n.prop('table.item_width'), field: 'itemWidth', width: 70, cssClass: 'disabled item-width'},
{title: $.i18n.prop('table.item_height'), field: 'itemHeight', width: 70, cssClass: 'disabled item-height'},
{title: $.i18n.prop('table.warehouse_storage_unit'), field: 'warehouseStorageUnit', width: 70, cssClass: 'disabled warehouse-storage-unit'},
{title: $.i18n.prop('table.position_text'), field: 'positionText', editor: 'input', width: 200}]);
AJAX-Response
[
{
"posNumber":"1",
"classSymbol":"fa-shopping-cart",
"itemNumber":"V000092",
"itemName":"Test asd asd a ",
"itemLength":1234000.34,
"itemWidth":0.0,
"itemHeight":0.0,
"warehouseStorageUnit":"mm",
"positionText":"jsdfakjfjöq",
"quantity":12.0,
"fCode":"ML",
"benefit":12.0,
"cutLength":0.0,
"cutWidth":0.0,
"cutHeight":0.0,
"edge":"H",
"edgeProperty":"",
"provisionType":""
}
]
发生这种情况是因为您启用了 autoColumns。
启用自动列后,它将根据返回的数据自动创建 tables 列。
如果您想首先定义列,那么您不应该在 table 设置中定义 autoColumns 选项
在 tabulatorJS 中通过 ajax 加载数据后,header 列标题更改为数据值名称。 ajax 响应是 java object,它与制表符列中的字段名称具有相同的属性名称。 您可以在本文底部看到回复。 Data found
如果未找到数据,则 table 已正确呈现。 No data found
你有什么想法吗?
table = new Tabulator("#table-div", {
ajaxURL: '/loadDataObject.do',
ajaxConfig: 'GET',
ajaxParams: {name: $('#name').val()},
// data: dataObject,
responsiveLayout: true,
keybindings: true,
locale: true,
langs: {
"de-de": {
}
},
movableColumns: true,
movableRows: true,
resizableRows: false,
headerSort: false,
autoColumns: true,
autoResize: true,
layout: 'fitColumns',
placeholder: $.i18n.prop('table.no_data_found'),
columns: [
{rowHandle:true, formatter:"handle", headerSort:false, frozen:true, width:30, minWidth:30, cssClass: 'disabled'},
{title: $.i18n.prop('table.pos_number'), field: 'posNumber', editor: 'input', width: 40},
{title: $.i18n.prop('table.symbol'), field: 'classSymbol', width: 45, cssClass: 'disabled item-symbol'},
{title: $.i18n.prop('table.item_work_operation_number'), field: 'itemNumber', editor: 'input', width: 70, cssClass: 'item-number text-uppercase'},
{title: $.i18n.prop('table.item_work_operation_name'), field: 'itemName', width: 300, cssClass: 'disabled item-name'},
{title: $.i18n.prop('table.item_length'), field: 'itemLength', width: 70, cssClass: 'disabled item-length'},
{title: $.i18n.prop('table.item_width'), field: 'itemWidth', width: 70, cssClass: 'disabled item-width'},
{title: $.i18n.prop('table.item_height'), field: 'itemHeight', width: 70, cssClass: 'disabled item-height'},
{title: $.i18n.prop('table.warehouse_storage_unit'), field: 'warehouseStorageUnit', width: 70, cssClass: 'disabled warehouse-storage-unit'},
{title: $.i18n.prop('table.position_text'), field: 'positionText', editor: 'input', width: 200}]);
AJAX-Response
[
{
"posNumber":"1",
"classSymbol":"fa-shopping-cart",
"itemNumber":"V000092",
"itemName":"Test asd asd a ",
"itemLength":1234000.34,
"itemWidth":0.0,
"itemHeight":0.0,
"warehouseStorageUnit":"mm",
"positionText":"jsdfakjfjöq",
"quantity":12.0,
"fCode":"ML",
"benefit":12.0,
"cutLength":0.0,
"cutWidth":0.0,
"cutHeight":0.0,
"edge":"H",
"edgeProperty":"",
"provisionType":""
}
]
发生这种情况是因为您启用了 autoColumns。
启用自动列后,它将根据返回的数据自动创建 tables 列。
如果您想首先定义列,那么您不应该在 table 设置中定义 autoColumns 选项