VueJs Can't fill data from store.index.json into DataTables

VueJs Can't fill data from store.index.json into DataTables

IgorBIgorB Posts: 6Questions: 0Answers: 0

Hello,
I've a VueJs project. I try to use DataTables.net. Component Page send to DataTables-component a value and than into DataTables-component call a appropriate (with value from Page) api-request in store (index.js). Data recieved in JSON-format (in index.js). How can use JSON-data with DataTables? Pass this JSON-data into DataTables - component? Thanks

Replies

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin

    Assuming the JSON is just an array of data for rows you could possibly use rows.add():

    table.rows.add(json);
    

    But it will depend what your JSON structure is?

    Allan

  • IgorBIgorB Posts: 6Questions: 0Answers: 0

    Thanks. I made it. But now i've a problem with default style.
    I try to use multi-rows select. In HTML it works, but in VueJs don't.

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

    Have you define style: multi? See example here,

    Colin

  • IgorBIgorB Posts: 6Questions: 0Answers: 0

    Thanks for Your answer. But can't additive correctly datatables.min.css to component DataTables into Vue-proects.

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin

    Is the DataTable being initialised while it is hidden (not in the document)? If so, you need to initialise our Select control manually with:

    $.fn.dataTable.select.init(dt);
    

    where dt is the DataTable API instance for the target table.

    Allan

This discussion has been closed.