Create Tabs with Different Views in DataTable

Create Tabs with Different Views in DataTable

zgoforthzgoforth Posts: 493Questions: 98Answers: 2

Hello, I know this isn't a "proper question" but I am very curious. I have created a DataTable before but was unsure if this is a possible feature or not. I am trying to make a leaderboard, that will have the columns Name | Weight % | Steps | Minutes. I also want to have Name | Weekly Weight % | Weekly Steps | Weekly Minutes. Is there a way to achieve tabs or two different views without compiling all of this mess into one data table or having to make another one?

Answers

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

    This example from this thread shows how to create BS4 tabs,

    Colin

  • zgoforthzgoforth Posts: 493Questions: 98Answers: 2

    @colin Thank you so much!

  • zgoforthzgoforth Posts: 493Questions: 98Answers: 2

    @colin One more question, all I see in relevance to dynamic data to populate the DataTable is AJAX, I am assuming fetch is supported correct?

  • kthorngrenkthorngren Posts: 21,178Questions: 26Answers: 4,923

    I am assuming fetch is supported correct?

    Not sure what you mean by fetch but the supported data sources is documented here. You can see examples of each here.

    Kevin

  • zgoforthzgoforth Posts: 493Questions: 98Answers: 2

    @kthorngren Fetch API, I have started to use this instead of AJAX

  • kthorngrenkthorngren Posts: 21,178Questions: 26Answers: 4,923

    Sure, just use rows.add() or initialize the Datatable and use data in the fetch API's success callback to populate the Datatable. If you are using it with Datatables now then Tabs wont change how it works.

    Kevin

  • zgoforthzgoforth Posts: 493Questions: 98Answers: 2

    @kthorngren thank you. I am going to make a new question on clarification of a different subject but related to this tabbed table.

This discussion has been closed.