Search button(Expecting No records found) in template grid

0
Hi, I have template grid which has number of records shown. And I have added few search buttons for search purpose which is working fine but if no record found there is nothing shown inside the grid. Is there a way to show text like “No record found” in case of failed search scenario in Mendix Studio 9 Pro.
asked
3 answers
0

Hi Earnestine Paula,

Use the below class which may help to show the custom message

.mx-templategrid-empty {
    text-align: center;
    background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgb(234, 233, 233) 100%);
    position: relative;
    border: 1px solid #898787 !important;
    overflow: hidden;
}
.mx-templategrid-empty:after {
    content: "No result found";
    position: relative;
    top: -15px;
}

answered
0

Hi Earnestine,

The template grid is slightly different than a list view. If you inspect the elements you can see that wherever content is not present a class with mx-template-grid-empty is added. So we can’t simply target this class and show a message as we would want.

I did make some tweaks and the below class will work in all cases, when you’ve data or when there is no data in the template grid or if simply the search criteria did not yield any result. Note – I did add an additional class to the template grid so that I apply it to the specified one only. If you want it to be applied to all template grids in the application just remove the grid-empty class also from below css code.

For more information on how you can modify and add custom styles take a look at the documentation → https://docs.mendix.com/howto/front-end/customize-styling-new

.grid-empty {

    .mx-grid-content .mx-templategrid-content-wrapper {

        .mx-templategrid-empty:first-child {

            text-align: right;

            &:after{

                content: 'No record found';

            }

        }

    }

}

 

Hope this helps!

 

EDIT: Screentshot of result. Note this was done in Mx 9.4 version

answered
0

 

I have pasted the code in the style widget of that respective template grid. Yet still not working

 

 

answered