Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

organgrindingmo
New Contributor III

Sorting in Qlik Sense Table Extension

Hi All

I am busy building a Qlik Sense extension which is basically a table with some custom features.

The next feature that I need to implement is sorting. The table does sort when you use the properties panel in "Edit" mode, I would like to add this functionality to the table when the user clicks on the Header of the column.

Some detail on the extension.

I am using the standard JS, HTML format, not the ng format.

I have a very basic InitialProperties object which does the initial data fetch. (as below)

Then I just loop through the Matrix of the DataPage that is returned to create an HTML table.

There is also a click handler on a button that fetches more data.

{
        qHyperCubeDef: {
            qDimensions: [],
            qMeasures: [],
            qInitialDataFetch: [{
                qWidth: 20,
                qHeight: 50
            }]
        }
    }

I can add a click handler on the headings and pass through the column index. So, I'm looking for a way to re-fetch the data and have it sorted by what is specified within the Properties panel for that Dimension or Measure.

I can see that there is a qSorting property on the qHyperCube but I'm not sure how to set his property and if it would affect the data when I make the call to the backendApi.getData() function.

Thanks in advance.

1 Solution

Accepted Solutions
erik_wetterberg
Valued Contributor III

Re: Sorting in Qlik Sense Table Extension

Hi,

I once did this in an extension that you'll find here:

https://github.com/erikwett/qsDynamicTable/blob/master/dynamictable.js

The trick is that it modifies the InternalSortOrder array dynamically, by calling applyPatches.

Erik Wetterberg

https://extendingqlik.upper88.com/

Erik Wetterberg
https://extendingqlik.upper88.com/
2 Replies
erik_wetterberg
Valued Contributor III

Re: Sorting in Qlik Sense Table Extension

Hi,

I once did this in an extension that you'll find here:

https://github.com/erikwett/qsDynamicTable/blob/master/dynamictable.js

The trick is that it modifies the InternalSortOrder array dynamically, by calling applyPatches.

Erik Wetterberg

https://extendingqlik.upper88.com/

Erik Wetterberg
https://extendingqlik.upper88.com/
organgrindingmo
New Contributor III

Re: Sorting in Qlik Sense Table Extension

Thanks so much, your solution works perfectly.

I also read your blog post about it, great article.

https://extendingqlik.upper88.com/dynamically-modify-a-qlik-sense-visualization/