OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Ordinal number on datagrid

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander 9 years, 2 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #33690

    infocurci
    Participant

    Hello,
    How I can add an ordinal number before every record of a datagrid?
    For instance, this is my datagrid:

    And this is what I would get:

    Thanks a lot!!!

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #33691

    Alexander
    Moderator

    Hello @infocurci !

    As I understood, you want some, let’s say, “virtual” grid column which will not exist in schema but will be displayed in a grid and will represent rows numeration ?

    If you want numeration only per page (without taking into account grid’s pagination) and only for particular grid, it can be done on frontend side, so declare new column in yours datagrid.yml

    do not add anything into ‘filters’ and ‘sorters’ for such column, because you will not be able to sort or filter.
    You also can set ‘type: twig’ and define ‘template’ for your numeration column, where you can provide some markup for numbers (if needed). So, this will add new empty column (<td>) into grid.

    At last in view template you will need some JS…

    Not the best solution, i think, but pretty fast one ;)
    But if you want continuous numbering through all grid’s pages – this should be done in backend and will be more complex.

    P.S. Thanks for the good question. It looks like improvement for our grids. Will investigate it.

Viewing 1 replies (of 1 total)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top