More swipe templates for RadListView possible?

ios
swipe

#1

Hello, did somebody try to assign more Swipe templates for itemTemplates in RadListView? I have successfully implemented two templates for RadListView with one SwipeTemplate, however most probably I need to have two different swipe templates for each item Template… or is there more simple way…

I need to allow/disallow Delete swipe action in each ListView item according the its status - isShared variable. isShared variable is available for each item in Items, it is successfully used also as a template selector (key= true/false) for regular templates.

For displaying different views in the ListView it works well, unfortunately for swipe actions it always gives me (in .js) swipeView.getViewById(‘delete-view’).getMeasuredWidth() zero (0) value, so swipe action (Delete) is not displayed at all… Do you know why it is still zero for each item, despite it should be displayed (visible)?
I appreciate any help or advice. Thanks

Here is my XML code…

<lv:RadListView row=“1” items="{{ Items }}" itemTap=“selectItem” itemTemplateSelector=" isShared " swipeActions=“true” itemSwipeProgressStarted=“onSwipeCellStarted” class=“list-group” colSpan=“2”>
lv:RadListView.listViewLayout
<lv:ListViewLinearLayout scrollDirection=“Vertical” />
</lv:RadListView.listViewLayout>

<lv:RadListView.itemTemplate>
		<GridLayout class="list-group-item" rows="auto" columns="auto, *" style.backgroundColor="yellow">
    		<Image class="tumb img-rounded" row="0" col="0" src="{{img}}" height="70" width="70" />
    		<StackLayout row="0" col="1">
        			<Label class="list-group-item-heading  mtir-l" text="{{name }}" color="#d9534f" />
   			</StackLayout>
		</GridLayout>
</lv:RadListView.itemTemplate>
<lv:RadListView.itemTemplates>
            <template key= "true">
       		<GridLayout rows="auto" columns="auto, *" style.backgroundColor="green">
                		<Image  row="0" col="0" src="{{img}}" height="70" width="70" />
                		<StackLayout row="0" col="1">
                    		<Label text="{{name }}" color="#1f514f" />
			</StackLayout>
		</GridLayout>
            </template>
		<template key="false">
    		<GridLayout rows="auto" columns="auto, *" style.backgroundColor="white">
        			<Image row="0" col="0" src="{{img}}" height="70" width="70" />
			<StackLayout row="0" col="1">
            			<Label  text="{{name }}" color="#1f514f" />
        			</StackLayout>
		</GridLayout>
	</template>
</lv:RadListView.itemTemplates>
<lv:RadListView.itemSwipeTemplate>
	<GridLayout columns="auto, *, auto">
		<StackLayout id="delete-view" col="2" style="background-color: red;" tap="onRightSwipeClick" paddingLeft="16" paddingRight=“16" orientation="horizontal" visibility="{{isShared=='true' ? 'collapse':'visible'}}">
			<Label text=“Delete" style="text-size: 20" verticalAlignment="center" horizontalAlignment="center" />
		</StackLayout>
		<StackLayout id="mark-view" col="0" style="background-color: blue;" tap="onLeftSwipeClick" paddingLeft="16" paddingRight=“16" orientation="horizontal" visibility="{{isShared==‘false' ? 'collapse':'visible'}}">
			<Label text="Mark" style="text-size: 20" verticalAlignment="center" horizontalAlignment="center" />
		</StackLayout>
	</GridLayout>
</lv:RadListView.itemSwipeTemplate>
</lv:RadListView>

#2

You may try setting the visibility of delete button / layout based on the item being swiped using itemSwipeProgressStarted event.