Text for grid without data - Genexus Ev2 U7

1

In a webpanel, where I have a couple of grids that show me data, I need that, when one of the grids does not show data, I see a text (something like "no data to show") instead of leaving the header of that grid.

Ex: That something like this appears, when I do not have data:

Grid with data:

I have searched everywhere, and even asked the people of Artech, but I have not found anything. Does anyone know if it can be done and how?

Thank you.

    
asked by jam1981 12.07.2016 в 16:51
source

2 answers

2

Jam,

I think the best way is to put the grid in one table, and the text in another. in the refresh (or where the data is loaded) event do table1.visible = true and table2.visible = false if there are records or the opposite if not.

    
answered by 13.07.2016 / 03:56
source
2

A possible solution, which I like because it does not involve programming and with very little work can be used in all the grids of your application, is to use CSS to display a text within the grid, when it does not have rows.

The solution is based on using the pseudo-class ": empty" on the HTML table that is generated for the grid, and some extensibility options that have the GeneXus themes.

If, for example, your grid has the class WorkWith , you must include a Custom class in your theme with the name "WorkWith tbody:empty:after" . To add it, right click on the Custom node and select the "Add Class" option from the context menu.

Then, configure the properties of the new class in this way:

Display = block
Margin Top = 50px
Margin Bottom = 50px
Margin Left = 20px
Custom CSS Properties = content('<Aquí va el texto que quieres que aparezca>')

You can adjust the values of the margins or other aesthetic properties of the class to your liking, so that the message has the design you prefer.

This solution that I propose does not hide the head, so it will only serve you if it is acceptable for you to appear the head when there is no data. An alternative is to follow the steps proposed in another answer, in which they suggest hiding and showing controls depending on the number of records in the grid.

    
answered by 14.07.2016 в 14:16