I'm using ExtJS 4.0 grid and want to display a message (or HTML, or component) inside the grid area when there are no records found. I've been rummaging through their code for a while and can't seem to find any evidence that this exists natively in their library. Is there a con开发者_Python百科fig or method I can use for this or will I have to roll my own?
Thx
ExtJS 4 do provide you with the functionality of displaying a message inside the grid area when there is no records in your grid's store. You need to use the viewConfig for doing this. Here is an example:
viewConfig: {
emptyText: 'There are no records to display'
}
Now, if you are using a local store (or loading data directly to the grid using data
) then you will need to set deferEmptyText
to false. This is clearly explained in the documentation of grid's view. Refer to the config properties emptyText
and deferEmptyText
.
ExtJS 4.1
emptyText: 'No Record to Display',
viewConfig: {
deferEmptyText: false
}
worked for me... :)
This configuration will solve your problem
viewConfig : { emptyText: 'No Record to Display', deferEmptyText: false }
Does not show. Searching for 'No Records...' in chrome inspect I do find the element, but it is not visible on the screen { xtype: 'grid', viewConfig : { emptyText: 'No Records to Display', deferEmptyText: false }, title: '', id: 'resultsTableGrid', store: me.store, columns:gridColumns }
As 'Abdel Olakara' said, the following works when fetching from remote server on ExtJS Version: 4.0
viewConfig : {
emptyText: "No Records....",
deferEmptyText: false
}
精彩评论