Unable to process data due to invalid data type
See original GitHub issueHey there! I saw a very similiar post here, but the answer did not help me, so please help me! Our company decided to give this plugin a shot, and it looks like a great way to display data in tables; I think I already have fallen in love with it!
I am currently facing a problem however, when I want to load data into a table from my VB.net backend page using an ajax request. This is the error I get:
Data Loading Error - Unable to process data due to invalid data type Expecting: array Received: object Data: {d: “[{“id”:1,“name”:“Bryon Hetrick”,“age”:43,“dob”:”“}…{“id”:1,“name”:“Rose Hetrick”,“age”:33,“dob”:”“}]”}
My code looks like this:
Table:
$("#example-table").tabulator({
height: 205, // set height of table, this enables the Virtual DOM and improves render speed dramatically (can be any valid css height value)
layout: "fitColumns", //fit columns to width of table (optional)
columns: [ //Define Table Columns
{ title: "Name", field: "name", width: 150, align: "center" },
{ title: "Age", field: "age", align: "left", formatter: "progress" },
{ title: "Favourite Color", field: "col", align: "center" },
{ title: "Date Of Birth", field: "dob", sorter: "date", align: "center" },
],
});
OnClick on a button that fires ajax request:
$('#btnajax').on('click', function (e) {
console.log("ajax request button clicked");
var ajaxConfig = {
type: "POST", //set request type to Position
contentType: 'application/json; charset=utf-8', //set specific content type
};
$("#example-table").tabulator("setData", "PurchaseOrder.aspx/returnfunc", {}, ajaxConfig); //make ajax request with advanced config options
});
Thanks in advance 😃
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
tabulator Unable to process data due to invalid data type
Ok I figured it out. Here's what I did var table = new Tabulator("#tabulator-example", { height:800, data:data, layout:"fitDataStretch", ...
Read more >Invalid Data Type Error - OutSystems 11 Documentation
The Invalid Data Type Error is issued, for example, when you use an Expression widget or a REST API method. Double-click on the...
Read more >#Invalid Data Type — Smartsheet Community
The error #INVALID DATA TYPE is saying that the formula either contains or references an incompatible data type, such as =INT("Hello"). This ...
Read more >COBRA Administration Error: "Invalid Datatype Specified"
COBRA Administration Error: "Invalid Datatype Specified" (Doc ID ... The COBRA COBOL process is failing with the following error message.
Read more >WAS service unable to start with the error 'the data is invalid'
The Windows Process Activation Service service could not be started. A system error has occurred. System error 13 has occurred. The data is ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey,
If you are making the ajax request as soon as you have built the table then you can set it in the table constructor object. the ajaxResponse function also wants to be added to your constructor object:
Just to clarify the expected data, Tabulator is expecting this:
You are returning this:
The ajaxResponse function tells Tabulator to look for the data in the d property of the object you are returning
Cheers
Oli
Thanks a ton! This worked! (I have one more question, but it is very different, so I will probably ask a new question later today!)