infor-cloud / m3-h5-sdk

https://infor-cloud.github.io/m3-h5-sdk/
34 stars 20 forks source link

Is it possible to have two sorted columns in the same datagrid ? #175

Closed Messaoudi-Nagib closed 1 year ago

Messaoudi-Nagib commented 1 year ago

Description

Hi, I wonder if it's possible to make a double sort for two different colmuns ? To give you an example : I want to sort my datagrid by date and also by hours. Currently, I've made this, but this doesn't seem to work :

this is my dataGrid setting :

      const options: SohoDataGridOptions = {
         isList: true,
         cellNavigation: false,
         idProperty: 'col-ITNO',
         paging: true,
         pagesize: 5,
         filterable: true,
         rowHeight: 'extra-small',
         stickyHeader: false,
         hidePagerOnOnePage: false,
         indeterminate: false,
         columns: [
            {
               width: '8', id: 'col-date-saisie', field: 'RGDT', name: 'Date transaction',
               resizable: true, sortable: true, filterType: 'date', filterConditions: ['equals', 'less-than', 'less-equals', 'greater-than', 'greater-equals'], formatter: this.formatterDate, dateFormat: 'ddMMyyyy',
            },
            {
               width: '5', id: 'col-heure', field: 'RGTM', name: 'Heure',
               resizable: true, sortable: true,
            },
            {
               width: '8', id: 'col-mplacement', field: 'WHSL', name: 'Emplacement',
               resizable: true, sortable: false,
            },
            {
               width: '8', id: 'col-type-transac', field: 'TTID', name: 'Type transaction',
               resizable: true, sortable: false, formatter: this.formatterTypeVente
            },
            {
               width: '6', id: 'col-qte', field: 'TRQT', name: 'Quantité',
               resizable: true, sortable: false, align: 'right'
            },
            {
               width: '8', id: 'col-nouveau-stock', field: 'NSTQ', name: 'Nouveau stock',
               resizable: true, sortable: false, align: 'right'
            },
            {
               width: 'auto', id: 'col-no-cmd', field: 'RIDN', name: 'No cde',
               resizable: true, sortable: false, align: 'right'
            },
            {
               width: 'auto', id: 'col-texte-reference', field: 'RFTX', name: 'Texte reférence',
               resizable: true, sortable: false,
            },
            {
               width: '4', id: 'col-designation-2', field: '', name: 'Designation 2',
               resizable: true, sortable: false,
            },
            {
               width: '3', id: 'col-lgcdrf', field: 'RIDL', name: 'LgCdRf',
               resizable: true, sortable: false,
            },
            {
               width: 'auto', id: 'col-date', field: 'TRDT', name: 'Date',
               resizable: true, sortable: false, formatter: this.formatterDate, dateFormat: 'ddMMyyyy'
            }
         ],
         /* Affectation des données à la grid M3 */
         dataset: [],
         emptyMessage: {
            title: 'Aucune donnée à afficher',
            icon: 'icon-empty-no-data'
         }
      };
      this.dataGridHistoriqueArticlesOptions = options;
   } 

and I've done this for having my datagrid automatically sorted when the page is ready :

this.dataGridHistoriqueArticles.setSortColumn('col-date-saisie');
 this.dataGridHistoriqueArticles.setSortColumn('col-heure');

It seems like it's not working and I don't know how to do for making this combo-sort work. Thank you

Versions

Infor Soho H5 angular application

tmcconechy commented 1 year ago

The Soho Datagrid only supports sorting on one column at a time (repo: https://github.com/infor-design/enterprise)

Messaoudi-Nagib commented 1 year ago

Alright thank you for the reply, have a great day @tmcconechy !