1. #1
    Ext User
    Join Date
    May 2010
    Posts
    4
    Vote Rating
    0
    rsandeep is on a distinguished road

      0  

    Default update 'emptyText' value dynamically

    update 'emptyText' value dynamically


    Hi All,

    I want to update the grid's 'emptyText' value once I get the response back from server.

    Currently I am using 'emptyText' as below to show message to the user initially when request is not made.

    for example ::
    Code:
    viewConfig: {
    				deferEmptyText: false,
    				emptyText: "Please select country"
    		}
    Once the user selects the 'country' from dropdown, I am making a server call to get the required values(here it is states). If the server response is zero records then I want to show the different message to user saying 'There are no states'. For this I need to update the 'emptyText' value dynamically.

    I tried many ways but in vain.

    Please anyone suggest me here.

    -thnx,sandeep

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Code:
    grid.getView().emptyText = 'Some text';
    grid.getView().applyEmptyText();

  3. #3
    Ext User
    Join Date
    May 2010
    Posts
    4
    Vote Rating
    0
    rsandeep is on a distinguished road

      0  

    Default


    thnx Condor.

    I am getting 'grid is not defined' error. I tried putting grid name also but its not working.

    plz help me.

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    My example assumed that you assigned the gridpanel instance to a variable named 'grid'.

    Does your grid have an id so you can use Ext.getCmp()?

  5. #5
    Ext User
    Join Date
    May 2010
    Posts
    4
    Vote Rating
    0
    rsandeep is on a distinguished road

      0  

    Default


    Condor,

    I tried but still getting the error - Ext.getCmp("exGrid").getView is not a function


  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Are you sure exGrid is the id of the grid? And has the grid been created from it's config object?

  7. #7
    Sencha User
    Join Date
    Jan 2013
    Posts
    2
    Vote Rating
    0
    kanak09 is on a distinguished road

      0  

    Default


    Hello,
    I have the same issue. I would like to change dynamically the emptyText depending on the response of the server (sometimes syntax error, sometimes empty field...etc).

    My code :

    Code:
    panel.store.on('load', function(store, records, options) {
    
    
        	    	if( store.getProxy().getReader().jsonData.error)
        	    		emptyText = ERROR_SYNTAX  
        	    	else if( store.getProxy().getReader().jsonData.results && store.getProxy().getReader().jsonData.results.length == 0)
        	    		emptyText =  ERROR_NO_RESULTS ;
        	    	
        	    	if(emptyText != "")
        	    	{
        	    		panel.viewConfig.emptyText = emptyText;
        	    		//panel.getView().refresh;
        	    		//panel.viewConfig.applyEmptyText();
        	    	}
    
    
        	    }, panel);
    As you can see, after each reload of the store, i check the answer and change the emptyText. The thing is that it works but one time later, for sure because of a refresh but i can't figure out how to do it. In few words, after the first server response if i have a syntax error, the emptyText will display the welcome message. Then if I query again, and the server response is an empty results, the panel will display the syntax error of before... and so on (1 time later).

    I tried panel.getView().refresh : no errors, but does nothing
    I tried panel.viewConfig.applyEmptyText(): applyEmptyText is not a function
    I tried panel.applyEmptyText() : applyEmptyText is not a function

    Can someone solved this issue ?
    Thank you.

  8. #8
    Sencha User
    Join Date
    Mar 2012
    Location
    California
    Posts
    12
    Vote Rating
    1
    panshr is on a distinguished road

      0  

    Default This should work!!!

    This should work!!!


    grid.getView().emptyText = 'Some text';grid.getView().refresh();

Similar Threads

  1. dynamically setting emptyText
    By eskimo87 in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 7 Aug 2012, 7:06 AM
  2. How to update interface dynamically from servlet?
    By sahar_m in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 23 Feb 2010, 5:42 AM
  3. Can I Dynamically Update the GUI?
    By wekkaw in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 18 Apr 2008, 5:23 AM
  4. Update title for a field dynamically
    By mehal in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 11 Sep 2007, 6:17 AM

Thread Participants: 3

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar