How to properly apply datatable to mvc object json data

How to properly apply datatable to mvc object json data

netcodernetcoder Posts: 3Questions: 1Answers: 0

I'm trying to apply datatable to the following type of json data coming from asp.net web core:

Object{ questionID:1,questionType:1,displayText: "Yellow Car",.....}
Object{ questionID:2,questionType:1,displayText: "Blue Car",.....}
Object{ questionID:2,questionType:1,displayText: "Green Car",.....}

I get the error:
DataTables warning table id= QuestionsTable - Requested unkown parameter 0 for row 0.
However the datatable gives me a count of 17 entries but doesn't show any data other than that.

Answers

  • kthorngrenkthorngren Posts: 21,315Questions: 26Answers: 4,948

    Looks like you need to use columns.data. See the Data docs for details.

    Kevin

  • netcodernetcoder Posts: 3Questions: 1Answers: 0

    Yeah tried that but didn't help. Still gives the same error..

  • netcodernetcoder Posts: 3Questions: 1Answers: 0
    edited April 2022

    What exactly does that error mean? I don't understand.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • kthorngrenkthorngren Posts: 21,315Questions: 26Answers: 4,948

    The link in the error describes the error and troubleshooting steps:
    https://datatables.net/manual/tech-notes/4

    Kevin

Sign In or Register to comment.