2014-07-25 30 views
0

我想显示一个窗口,其中包含用户从组合框到server的请求后发生错误的详细信息。如果发生异常,我将它放入json对象并发送到cline side.Json对象就是这样。与更新相关的问题JsonStore ExtJs 3.4

{ 
    {"error_message": "java.lang.NullPointerException: null"}  
    items: [] 
} 

这是我的代码,我发送和接收data.I've试图JsonStor的每listerner到chatch数据但也不能正常工作的一部分,是implemantation.I'm使用ExtJS的3.4以下。

this.folderNameStore = new Ext.data.JsonStore({ 
      proxy: new Ext.data.HttpProxy({ 
       url: this.config.folderNamesPath, 
       method: 'GET', 
       timeout: 120000 
      }), 
      listeners: { 
       beforeload: { 
        fn: function() { 
         var informaticaRepositoryId = this.getInformaticaRepositoryId(); 
         if (informaticaRepositoryId) { 
          this.folderNameStore.setBaseParam('informatica_repository_id', informaticaRepositoryId); 
         } 
        }, 
        scope: this 
       } 
      }, 
      root: 'items', 
      idProperty: 'folder_name', 
      fields: ['folder_name'] 
     }); 
     // Custom rendering Template 
     resultTpl = new Ext.XTemplate('<tpl for="."><div class="informatica_workflow_command_folder_name-finder-item finder-item x-combo-list-item">', '<h2 class="name">{folder_name}</h2>', '</div></tpl>'); 

     this.folderNameComboBox = new Ext.form.ComboBox({ 
      allowBlank: false, 
      applyTo: "informatica_workflow_command_folder_name", 
      disabled: true, 
      displayField: 'folder_name', 
      forceSelection: false, 
      hideTrigger: false, 
      mode: 'remote', 
      itemSelector: 'div.informatica_workflow_command_folder_name-finder-item', 
      listClass: 'job-agents-combobox', 
      listEmptyText: helpsys.locale.javascript.no_matching_record, 
      loadingText: helpsys.locale.common.searching, 
      minChars: 4, 
      submitValue: false, 
      store: this.folderNameStore, 
      tpl: resultTpl, 
      triggerAction: 'all', 
      typeAhead: true, 
      maxLength: 80, 
      maxHeight: 400, 
      autoCreate: {tag: 'input', type: 'text', maxlength: '80'}, 
      valueField: 'folder_name', 
      itemSelected: false, 
      oldValue: '', 
      listeners: { 
       change: function() { 
        this.updateFolderNameComboBox(); 
       }, 
       select: function() { 
        this.updateFolderNameComboBox(); 
       }, 
       keyup: function() { 
        this.updateFolderNameComboBox(); 
       }, 
       scope: this 
      } 
     }); 

     this.updateFolderNameComboBox = function() { 
      if (this.folderNameComboBox.value == '') { 
       this.workflowNameComboBox.markInvalid(); 
      } else { 
       if (this.folderNameComboBoxValue != this.folderNameComboBox.getValue()) { 
        this.workflowNameComboBox.markInvalid(); 
       } 

       this.workflowNameComboBox.store.removeAll(); 
       this.workflowNameComboBox.lastQuery = null; 
       this.workflowNameComboBox.enable(); 

       this.folderNameComboBoxValue = this.folderNameComboBox.getValue(); 
      } 
     }; 

回答

2

添加一个被调用的存储加载功能: Ext.data.StoreManager.lookup( 'folderNameStore')上( '负荷',this.folderNameStoreLoaded);

然后在函数只是像做Ext.getStore(“folderNameStore”)。proxy.reader.jsonData

然后你就可以做你的弹出通知if语句像 如果(成功= =“error”){Ext.MessageBox.alert('Oh No','Oh No !.);}

希望有所帮助。

+0

对不起没有3.4,但它看起来像这可能工作: http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.StoreMgr – JesseRules