jfernandez_04
jfernandez_04

Reputation: 152

dojox.grid.EnhancedGrid how do i set a noDataMessage?

I'm trying to set a noDataMessage into a dojox.grid.EnhancedGrid, the grid works fine, when the store get data it show it's row with no problem, but I need that when the store gets no data the grid would show me a personalized message. I set the noDataMessage property which is a string, but nothing happened when has no data.

How can I trigger the event when no data in the store?

I get my data through a SQL query to a database and the answer is JSON serialized data.

here's the code of my grid.

    intersGrid = new dojox.grid.EnhancedGrid({
//        plugins: {dnd: true},viewInterconsulta
        id :"intersGrid",
        store: interfiltStore,
        structure: intersLayout,
        noDataMessage:"<span class=\"dojoxGridNoData\">No hay Datos</span>",
        loadingMessage:'Cargando datos. Por favor espere.',
        //noDataMessage: 'No existen pacientes esta agenda.',
        errorMessage:'No existen datos para esta busqueda.'
    }, "intersDiv");

Upvotes: 3

Views: 1349

Answers (2)

Philipp G&#228;chter
Philipp G&#228;chter

Reputation: 960

In my case, I only showed 25 rows and then requested with help of offset & count another 25 when scrolling down the list. In this case, I needed "numRows" - which is the total amount of rows, leaving out offset & count. The "numRows" was set to 0 if no rows where found. But if it was given, the noDataMessage was not shown (btw: An "identifier" is not required).

Also there is a syntax error in your json, add some ":" after "items".

This is the JSON for the store, which shows the noDataMessage of a dojox datagrid:

{"items":[]}

This will not show it:

{"items":[],"numRows":"0"}

Using Dojo 1.6.1, a dojox.grid.DataGrid with a dojox.data.QueryReadStore

Upvotes: 0

jfernandez_04
jfernandez_04

Reputation: 152

solved.
What you have to do is.

if you get an empty store then set them like these:

$filas = "{ identifier: 'ID', items[]}";
**json_encode($filas)."}";

and then dojo shows the noDataMessage

Upvotes: 1

Related Questions