2016-06-01 7 views
0

(ルータを使用して)そのビューに移動した後、モデルをonBeforeShowフックのビューに設定しようとしました。ここでモデルをonBeforeShowのビューに設定するときのエラー

は私の関連するビューコードの一部です:

<Table items="{path:'model>/'}"> 
    <columns> 
     <!-- columns definition here --> 
    </columns> 
    <items> 
     <ColumnListItem> 
      <cells> 
       <Text text="{model>property1}"/> 
       <Text text="{model>property2}"/> 
       <Text text="{model>property3}"/> 
       <Text text="{model>property4}"/> 
       <Text text="{model>property5}"/> 
      </cells> 
     </ColumnListItem> 
    </items> 
</Table> 

その後、onBeforeShowに:

var oData = sap.ui.getCore().getModel("modelSource"); 
this.getView().setModel(oData, "model"); 

"modelSource"は、前のビューに定義されています。

モデルセットラインを実行すると、私は次のエラーを取得する:

TypeError: e.bindList is not a function

ここでは私のonBeforeShowフックの定義(クレジットthis postに)次のとおりです。

onInit: function() { 

    this.getView().addEventDelegate({ 
     onBeforeShow : jQuery.proxy(function(evt) { 
      this.onBeforeShow(evt); 
     }, this) 
    }); 
}, 

問題を解決する方法は?

ありがとうございました。

答えて

0

私が正しくmodelSourceモデルを定義していませんでした:

sap.ui.getCore().setModel(oData, "modelSource"); 

はそれを正しく定義:

sap.ui.getCore().setModel(new sap.ui.model.json.JSONModel(oData), "modelSource"); 

は、エラーを修正しました。

関連する問題