1. #1
    Sencha User
    Join Date
    Feb 2009
    Posts
    264
    Vote Rating
    0
    Stephan123 is on a distinguished road

      0  

    Default send message from server

    send message from server


    Hello !

    I have a grid.

    Code:
     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.

    Code:
    jsonStoreProducts.load();
    In same situation i have no data and
    i will send a message to the user.

    Code:
    Ext.messageBox.alert('no data');
    I there a simple way to send a message ?

    Sorry for my bad english.

    Your sincerly Stephan

  2. #2
    Sencha User
    Join Date
    Dec 2009
    Posts
    364
    Vote Rating
    2
    raj_plays is on a distinguished road

      0  

    Default


    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 .

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Posts
    264
    Vote Rating
    0
    Stephan123 is on a distinguished road

      0  

    Default Message from the server

    Message from the server


    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

  4. #4
    Sencha User
    Join Date
    Dec 2009
    Posts
    364
    Vote Rating
    2
    raj_plays is on a distinguished road

      0  

    Default


    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

  5. #5
    Sencha User
    Join Date
    Jan 2011
    Posts
    546
    Vote Rating
    52
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    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.

Thread Participants: 2