OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Tabulator list editor sorting

  • Thread starter Thread starter Panagiotis Koumoundouros
  • Start date Start date
P

Panagiotis Koumoundouros

Guest
I have a column whose editor is a list. I am trying to sort the items in the editor list according to the following logic:

The editor parameters values is an array of vendors in the form of

Code:
{1: "amazon", 2: "eBay", 3: "stock", 4: "fuel"}

Some of them belong to a special category and have to be displayed at the top of the list, let's say items 3 and 4, which are defined in an array called globalOrder in the form of [{id: 3, order: 1}, {id: 4, order: 2}]. id corresponds aValue/bValue and order is the desired order.

In my approach so far, I am creating a sort function called "sort_vendor_id" and setting in the column editorParams:

Code:
{sort: function(aLabel, bLabel, aValue, bValue) {sort_vendor_id(aLabel, bLabel, aValue, bValue, globalOrder);}}.

If a value is not in the id column of globalOrder it's order should not be affected.

I have been unable to interpret this logic in the sort_vendor_id function, so any help will be very welcome!

I have tried to extract the id column from globalOrder after sorting it properly but then I am stuck with how to put my logic into code.

<p>I have a column whose editor is a list. I am trying to sort the items in the editor list according to the following logic:</p>
<p>The editor parameters values is an array of vendors in the form of</p>
<pre><code>{1: "amazon", 2: "eBay", 3: "stock", 4: "fuel"}
</code></pre>
<p>Some of them belong to a special category and have to be displayed at the top of the list, let's say items 3 and 4, which are defined in an array called globalOrder in the form of [{id: 3, order: 1}, {id: 4, order: 2}]. id corresponds aValue/bValue and order is the desired order.</p>
<p>In my approach so far, I am creating a sort function called "sort_vendor_id" and setting in the column editorParams:</p>
<pre><code>{sort: function(aLabel, bLabel, aValue, bValue) {sort_vendor_id(aLabel, bLabel, aValue, bValue, globalOrder);}}.
</code></pre>
<p>If a value is not in the id column of globalOrder it's order should not be affected.</p>
<p>I have been unable to interpret this logic in the sort_vendor_id function, so any help will be very welcome!</p>
<p>I have tried to extract the id column from globalOrder after sorting it properly but then I am stuck with how to put my logic into code.</p>
 
Top