SAPUI5:sap.m.Table中的从属选择

时间:2018-08-30 04:38:24

标签: sapui5

一个表由多个列组成,其中两个选择另一个,即区域取决于第一个国家(即国家/地区)。

带有应显示数据的表

enter image description here

表随着添加新行而改变

enter image description here

直到第1行一切正常。当添加第2行时,有时第1行的Region显示第2行的Region,类似于第二张图片。上方的第3行区域已更改,选择项也已更改。

用户尝试编辑表时模型会更改

enter image description here

初始表

enter image description here

能不能帮我知道我要去哪里错了?

我使用了以下代码:

表格:

<Select
    selectedKey="{tempModel>Country}"
    change='onSelectTableCountry'
    items="{path:'/CountrySet', templateShareable:'true'}">
    <core:Item key="{Land1}" text="{Landx50}"/>
</Select>
<Select
    selectedKey="{tempModel>Region}"
    items="{path:'/RegionSet', templateShareable:'true'}">
    <core:Item key="{Bland}" text="{Bezei}"/>
</Select> 

Json模型:

"AddressSet": [{
      "Country"       :"",
      "Region"        :""
}],
"addAddress":{
      "Country"       :"",
      "Region"        :""
}

控制器:

onSelectTableCountry: function(oEvent){
	var aSelectedCell   = oEvent.getSource().getParent().getCells();
	var SelectedCountry = aSelectedCell[6].getSelectedKey();
	var oBinding        = oEvent.getSource().getParent().getCells()[7].getBinding('items');
	oBinding.filter([ new Filter([
		new Filter({
			path: 'Bland',
			operator: FilterOperator.EQ,
			value1: SelectedCountry
                })
         ])]);
},

handleIdentifyAdd: function(oEvent){
       var aTableData = this.tempModel.getProperty('/AddressSet');
       var pData         = jQuery.extend(true, {}, this.tempModel.getProperty('/addAddress'));
       aTableData.push(pData);  
       this.tempModel.setProperty('/AddressSet',aTableData);
},

0 个答案:

没有答案
相关问题