Great job ! I like listview function using multiple template. Isn't it got empty template when items is empty?
1 Answer, 1 is accepted
0
Nick Iliev
Telerik team
answered on 05 Jul 2017, 07:21 AM
Hi Lau,
Thank you for your interest in NativeScript!
You can create your own templates and implement your own logic that can check if the item passed is fulfilling your criteria (e.g. empty item).
e.g. the source array has one "empty" item (in this case no age property specified)
then using the itemTemplateSelector callback we can implement our custom logic
export function selectItemTemplate(item: any, index: number, items: Array<any>) {
return item.age ? "base" : "empty";
}
and from that point and item that does not have an age property will load the "empty" template
<template key="empty">
<StackLayout>
<!-- your empty template follows here -->
</StackLayout>
</template>
The same principle can be applied for both RadListView and ListView.
Regards,
Nikolay Iliev
Progress Telerik
Did you know that you can open private support tickets which are reviewed and answered within 24h by the same team who built the components? This is available in our UI for NativeScript Pro + Support offering.