One moment, we're cooking some code examples

Header image
DataStack

Let's stack some data

DataStack is a powerful built-in plugin designed to create dynamic and interactive tables with ease. It transforms how you handle and present data on your web applications by offering a range of features that ensure your tables are dynamic and responsive components.

Key features

  1. Dynamic Data Handling
    DataStack allows efficient handling of large datasets. Whether dealing with thousands of rows or just a few, DataStack ensures smooth and fast data processing and display.
  2. Interactive Sorting and Filtering
    Ssort and filter data seamlessly. Each column can be sorted in ascending or descending order, and filter options can be applied to help users find the information they need quickly and easily.
  3. Pagination
    DataStack supports robust pagination, enabling you to break down large datasets into manageable chunks. Users can navigate through pages effortlessly, ensuring a user-friendly experience.
  4. Customizable Appearence
    Full control over the look and feel of your tables. DataStack provides extensive customization options, allowing you to style your tables to match your application's design perfectly.

DataStack example

The example below gives you a basic visual representation of how to use DataStack. You can search, sort and navigate through all results.

Product Name
Price
Brand
Options
Philips The One 65PUS8508 - Ambilight (2023)1299.00DABMANPhilips
Samsung The Frame 65LS03B (2023)2199.00Samsung
Apple iPad Pro (2022) 12.9 inches 256GB WiFi Space Gray + Apple Pencil 21699.00Apple
Samsung Galaxy Tab S9 11 inches 128GB WiFi Black899.00Samsung
Apple iPhone 15 Pro Max 256GB Blue Titanium1479.00Apple
OnePlus 11 256GB Black 5G749.00OnePlus
Imperial DABMAN i205CD Zwart229.00 
JBL Tuner 2 Zwart92.00JBL
Philips 42OLED808 - Ambilight (2023)1209.00DABMANPhilips
Samsung QE55S95C - 55 inch - 4K QD-OLED - 20231449.00Samsung
Samsung QE55Q80C - 55 inch - 4K QLED - 2023669.00Samsung
Samsung Neo QLED 4K 55QN90D (2024) + Soundbar2529.00Samsung

How to setup your DataStack

Before setting up a new DataStack you'll neet to configure the endpoints so the plugin knows wher to find the data. Once you've got your endpoints you're ready to configure the plugin

This is done by defining 2 methods in your class, a YourClass::GenerateYourTableHTML method and a YourClass::ListValues

Request

This call wil setup your table. Use the following basic setup before calling your function. you can configue yours custom settings using the request array.

In your request array you must define the function call and element ID. All other values are optional

$aRequest
Variable Type Required Example / Description
sElementID String Yes Define an unique ID for DataStack to use it’s bindings
sFunctionCall String Yes Define function here to be called by DataStack, EX: YourClass::ListValues
sSearchPhrase String No Default search phrase
iMinSearchLength Int No Minimum length of search phrase
iMaxResults Int No Number of results shown (10, 25, 50, 100, 250)
iCurrentPage Int No The current page to display
sSortingKey String No Default sorting key
sSortingMethod String No "ASC" or "DESC"
bTriggerPageMode Boolean No "True" or "False", sets page-mode in StackBox

HTML Generation

Now that we've configured the initial call, let's have a look inside the initial function.

As you can see, the$aData array needs to be prepared before continuing. this process is fully automated and wil prepare your $aData array with all the values it needs.

DataStack also gives you the total results found so you can directly customize the total results message. Use the value of the int $iTotalResults to setup the string $sTotalResults. This string is shown on the right above the search results.

After we've prepared our data, then it's time to setup our table configuration, these are defined in the $aRequest array. You can check the "HTMLTable" documentation for additional options.

aHeadings
Variable Type Required Example / Description
sTitle String Yes Text displayed on column
sKey String Yes Define which value to use from array to display

To enable edit & delete, a heading item with sKey sTableRowOptions is required

aOptions
Variable Type Required Example / Description
sOptionsTitle String Yes Mouseover text for option button
sOptionIcon String Yes font awesome icon (ex: fa-pencil)
iOptionLinkTypeID Int Yes 0 = Default, 1 = Overlayer

aSettings
Variable Type Required Example / Description
bShowSearchOption Boolean Yes Enable / Disable search bar
bShowSortingOptions Boolean Yes Enable / Disable sorting buttons when defined in aHeadings
bShowNavigation Boolean Yes Enable / Disable pagination buttons
iMaxResults Int Yes Define the pagination limit
iTotalResults Int Yes Define total amount of results for pagination
sTotalResults String Yes Define total amount of results visually for pagination

$aRequest
Variable Type Required Example / Description
sElementID String Yes Define an unique ID for DataStack to use it’s bindings
aRequest Array Yes Original data request
aValues Array Yes The values you wish to display within the table
aOptions Array No Options for row items
aHeadings Array Yes Which columns to display
aSettings Array Yes Mostly display options

Data Request

This call wil submit a request to the API and wil fetch all the data you need.

The function is called automatically from the DataStack::Prepare() function and wil give you a raw respone from the API in an array called $aResponse

To have more control over the outcome you can enrich your data. With some simple checks you can prepare the data for output.

--data options description--

Source your DataStack

--description--

EXAMPLE HERE

Default Options

--description--

Request

--description--

EXAMPLE REQUEST HERE

Headings

--description--

EXAMPLE HEADINGS HERE

Custom Options

--description--

aOptions
aSweetAlert Array No * no documentation yet, see html.table.class.php:389 HTMLTable::GenerateOptions *

aHeadings
sHeadingClass String No css class to be used for the heading
sColumnClass String No css class to be used for the column
sWidth String No Define width of column in user defined units (ex: 200px or 10vw)

Request

--description--

EXAMPLE REQUEST HERE

Headings

--description--

EXAMPLE HEADINGS HERE

Advanced

Advanced functionality

Sorting, Searching & Pagination Data Request

To be able to use Sorting, Searching and Pagination, there are a few fields more required

First, to enable column sorting, you must add the bSortable in combination with sSortingKey this wil work fine if you use DTO's (propel) to generate the listing code. But if you use plain query's, you also need to define dbTable and dbColumn. Sorting wil default to sorting by ID Ascending

aHeadings
bSortable Boolean No True or False, must be combined with: sSortingKey, dbTable & dbColumn
sSortingKey String No Field to use sorting on, must be combined with: bSortable, dbTable & dbColumn
dbTable String No SQL Table to sort on, must be combined with: bSortable, sSortingKey & dbColumn
dbColumn String No SQL Column to sort on, must be combined with: bSortable, sSortingKey & dbTable
sSortingMethod String No ASC or DESC, can be combined with: bSortable, sSortingKey, dbTable & dbColumn
EXAMPLE SORTING/SEARCHING/PAGINATION HERE