Switching Status Text on and off.

I am trying to setup a grid that when first created and then displayed on the page, it does not load any data nor does it display the status message. However, once another grid is properly populated the grid would be populated with data and the status message would appear to display the loading message. Well, I've got the data population working correctly, but I can not seem to get the status message to work. When the grid is initially created, I have it such that the message is not displaying, but then I can't get it to go "back on" when the grid finally is retrieving its data. Here is the code.

When I first generate the grid, I shut off the status message.
obj.setStatusProperty("code", "");

Then, when I am ready to retrieve the data, right before doing the request, I run the following code:
obj.setStatusProperty('text', function(){switch(this.getStatusProperty('code')){case 'loading': return grid_loadingmessage; case 'nodata': return grid_nodatamessage; default: return '';}});

If I run the second code section on a grid that does not have the first code section, it runs correctly. If I run it on a grid that I applied the first code section to, the second section does not seem to work. I am not clear on the difference between the code and text properties, so I am sure that is where the problem lies, but I can't figure out how to get it to work correctly.

Any help is appreciated.

January 28,
Here is the original definition of the status/code property:

obj.defineStatusProperty("code", function(){

        var data = this.getDataModel();
        if (!data.isReady()) {
            return "loading";
        if (!this.getRowProperty("count")) {
            return "nodata";
        return "";

Instead of removing this logic you should add your own conditions to the code function, otherwise 'loading' and 'nodata' states are no longer activated.

obj.setStatusProperty("code", function(){
   // all the above + your own
Alex (ActiveWidgets)
January 28,
Unfortunately, I still can't get this to work. I set a property on the grid called del which stands for delayed load. If this is true, the load won't come until later and I don't want to display any message until the data is loaded. Below is an example of what I have done. For this grid, I set del to false.

obj.setProperty("del", false);
obj.defineStatusProperty('code', function(){
   var delayload = this.getProperty("del"); 
   var data = this.getDataModel(); 
   if (!delayload && !data.isReady()) {
       return 'Retrieving data, please wait.';
   if (!delayload && !this.getRowProperty('count')) {
       return 'No data found. Remove any active filters to broaden your search.';
   return '';

If I remove the check for the delayload variable (essentially leaving your original function) I still don't get a message in the grid.

Thanks for the help.
January 30,
I think I figured out how to deal with it. I set the delay not on the grid but on the status template.

obj.defineStatusProperty("delay", true);

Then I search for that. Works wonderfully. However, for future ref, how can I refer back to the grid itself from within a template?
January 31,

This topic is archived.

See also:

Back to support forum