Sorting is not working

Sorting is not working

  

Hi,

When i try to change or remove TableRecords class from Table records widgets then Sorting is not working..


Hi Shoeb,

This is in fact the case and it's not a bug.

The RichWidgets_List_Sortcolumn uses the TableRecords class of the table to file the table's Id. So if you remove this class, it won't find it.

SyntaxEditor Code Snippet (Javascript from List_SortColumn):

function RichWidgets_List_SortColumn(Column, linkId, sortColumn_OrderBy, pageName, inputTableRecordsId){
 outsystems.internal.$(function($) {
  var columnHeader = $('#' + linkId).parents('th:eq(0)');
  
  columnHeader.click(function(){
   $('#' + linkId).triggerHandler("click");
  });
  var tableRecordsId = $('#' + linkId).parents('table.TableRecords:eq(0)').attr('id');
  $('#' + inputTableRecordsId).val(tableRecordsId);
  var isSortedColumn = sortColumn_OrderBy.indexOf(pageName + ":" + tableRecordsId + "=" + Column)>-1;
  if (isSortedColumn){
   columnHeader.addClass('SortColumns_Sorted');
  } else {
   columnHeader.addClass('SortColumns_Sortable');
  }
 });
}

Hi Shoeb,

You'll have to explain better what you are doing. "sorting" is a concept that can mean all kinds of things. What kind of sorting are you talking about? The RichWidgets List_SortColumn? Something else? Is it just the TableRecords class that causes this? If so, why do you want to remove it?

Kilian Hekhuis wrote:

Hi Shoeb,

You'll have to explain better what you are doing. "sorting" is a concept that can mean all kinds of things. What kind of sorting are you talking about? The RichWidgets List_SortColumn? Something else? Is it just the TableRecords class that causes this? If so, why do you want to remove it?

HI kilian,

I used List_SortColumn and i have to change design of default TableRecords widget for some specific requirement. 

Solution

Hi Shoeb,

As Lennart pointed, the default Richwidget ListSort_Column widget will not work if you remove the TableRecords class.

So, you have at least two options here.

1. Instead of REMOVING the class, CHANGE it in the Style Sheet of the page or application (if the change must be for the entire application). This way the widget will keep working.

2. Use a different sorting widget, like this: https://www.outsystems.com/forge/component/2671/list-record-sort/
It was done thinking in List Records, but it will work also in the Table Records, as you have to pass the Table id.

Cheers.

Solution

Eduardo Jauch wrote:

Hi Shoeb,

As Lennart pointed, the default Richwidget ListSort_Column widget will not work if you remove the TableRecords class.

So, you have at least two options here.

1. Instead of REMOVING the class, CHANGE it in the Style Sheet of the page or application (if the change must be for the entire application). This way the widget will keep working.

2. Use a different sorting widget, like this: https://www.outsystems.com/forge/component/2671/list-record-sort/
It was done thinking in List Records, but it will work also in the Table Records, as you have to pass the Table id.

Cheers.

Thanks Eduardo,

I would like to go with option 1..

Than, you will have to overwrite the style using the TableRecords class. You will have to inspect it and change it accordingly in the StyleSheet (not of the Base theme, but in your application or page).

Good luck :)

Cheers!

Eduardo Jauch wrote:

Than, you will have to overwrite the style using the TableRecords class. You will have to inspect it and change it accordingly in the StyleSheet (not of the Base theme, but in your application or page).

Good luck :)

Cheers!

Yes I have created theme based on Dublin theme and there i will overwrite it for application level.

Thanks again. :)


Just to add to the already given answers, if you really want to use another class (ex you have two tables in the same screen and only want to customize one of them), you can clone the ListSort webBlock and edit the javascript to find your class and use that one.