Skip to Content
0
Nov 09, 2018 at 01:44 PM

How to get visibility of all items in m.table which has a growing feature

111 Views

Hi,

In the below code , if I am setting the threshold, I am not able to get visibility of all the items. the table has 15 values now and its has to be loaded on scroll with the threshold of 5. Also the table has to set to "Navigation type" once the dataReceived event is called in which the table is binded with data and it has to navigate to the next page.

In the controller logic, getItems is taking only the 5 values and sets the navigation to the table's first five rows. While the page is scrolled its not loading the next five items also its showing the error " Cannot read property 'destroy' of undefined"error.png

View.xml

<smartTable:SmartTable id="smartTable" entitySet="h_set" smartFilterId="smartFilterBar" tableType="ResponsiveTable"initialise="onInitialise" demandPopin="true" initiallyVisibleFields="a,b,c,d,e" header="Rules"showRowCount="true" persistencyKey="smartTable_Persist" enableAutoBinding="false" dataReceived="onDataReceived" requestAtLeastFields="a,b,c,d,e" fieldChange="onFieldChange" useExportToExcel="true" ignoreFromPersonalisation="S,d,e,f">
	<Table growing="true" growingScrollToLoad="true"  growingThreshold="5" >
		<columns>
			<Column id="a" hAlign="Begin">
			<customData>
			<core:CustomData key="p13nData" value="\{"columnKey": "a", "columnIndex":"4", "leadingProperty": "a"}"/>
			</customData>
			<Text text="{i18n>a}"/>
			</Column>
			<Column id="b" hAlign="Begin">
			<customData>
			<core:CustomData key="p13nData" value="\{"columnKey": "b", "columnIndex":"5", "leadingProperty": "b"}"/>
			</customData>
			<Text text="{i18n>b}"/>
			</Column>
						
			</columns>
		<items>
		<ColumnListItem type="">
		<cells>
		<DatePicker id="vFrom" value="{path:'From',type: 'sap.ui.model.type.Date',formatOptions: {style: 'medium'}}" change="onFromChange" displayFormat="medium" enabled="false"/>
		<DatePicker id="vTo" value="{path:'To',type: 'sap.ui.model.type.Date',formatOptions: {style: 'medium'}}" change="onDatePickerChange"displayFormat="medium" enabled="false"/>
	<Input type="Text" value="{Description}" id="inputDes" liveChange="onLiveChange"/>
	<CheckBox selected="{RwS}" id="checkS" select="onLiveChange"/>
<CheckBox selected="{S}" id="checkS" enabled="false" select="onLiveChange"/>
		</cells>
		</ColumnListItem>
		</items>
	</Table>
	</smartTable:SmartTable>



Controller Logic: getItems()[i] is looped only for initial growing value.So how to get the full row items on scroll?

onDataReceived: function(event) {
for (var i = 0; i < this.getView().byId("smartTable").getTable().getItems().length; i++) {
this.getView().byId("smartTable").getTable().getItems()[i].setType("Navigation");
this.getView().byId("smartTable").getTable().getItems()[i].attachPress(this.onItemPress, this);
}
}

Attachments

error.png (15.6 kB)