PDA

View Full Version : send message from server



Stephan123
12 Dec 2012, 6:38 AM
Hello !

I have a grid.


gridProducts = new Ext.grid.GridPanel({
store: jsonStoreProducts,
autoHeight: true,
stripeRows: true,
width: 550,
loadMask: true,
columnLines: true,
id: 'productsGrid',
...


and i load data from my server in the grid.


jsonStoreProducts.load();

In same situation i have no data and
i will send a message to the user.


Ext.messageBox.alert('no data');

I there a simple way to send a message ?

Sorry for my bad english.

Your sincerly Stephan

raj_plays
13 Dec 2012, 4:56 AM
In the store's load event, do store.getTotalCount().
This will give you the number of records loaded.
If it is 0, show the alert .

Stephan123
13 Dec 2012, 5:59 AM
Hello!

Thanks for the answer. I want to publish a message,
that is created on the server. The show with the message to

Ext.messageBox.alert (myServerMessage) done.

Can I store.load () represent a message?

Sincerely yours

Stephan

raj_plays
14 Dec 2012, 3:27 AM
You mean in 1 operation you want to load records and get a message from the server side?
That is not possible but you can do this.
1. Load data
2. In the load event, do a Ext.Ajax.request that will get the message from the server
3. On success event , show the alert with the message

willigogs
20 Dec 2012, 7:03 PM
I your server side code, you could always check if you're returning zero records, and if so - return an additional message in the response to be used in your pop up message.

This way, you only need one request.