cancel
Showing results for 
Search instead for 
Did you mean: 

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

aruna_c
Explorer
0 Kudos

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);
}
}

Accepted Solutions (0)

Answers (1)

Answers (1)

maheshpalavalli
Active Contributor
0 Kudos

Dear Aruna

I am assuming that you want to set the navigation only for few table items.

If that is the case, you can use the formatter which dynamically sets the navigation type based on your data..

create a formatter in the controller and assign it to the type=".navigationFormatter"

and return Navigation based on your condition.

BR,

Mahesh

aruna_c
Explorer
0 Kudos

I need the navigation for the entire sap.m.table which is embedded within the smartTable. while setting the table type as "navigation" the growing items doesn't have the navigation since the scope is available for the growing threshold value.

Thanks.

maheshpalavalli
Active Contributor
0 Kudos

Then is there any reason why you are setting the type as space below:

<ColumnListItem type=""> // You can pass "Navigation" here right

BR,

Mahesh