Add a local path to the image file name for a RadListView

Thread is closed for posting
4 posts, 1 answers
  1. Dimitar
    Dimitar avatar
    66 posts
    Member since:
    May 2014

    Posted 23 Aug 2017 Link to this post


    I am trying to  add the local path folder when image should be displyed in 
    RadListView . I don't want to add this path in array source of the RadListView 

    Is there a way to make something like this or call a function to calculate the path

    <lv:RadListView items="{{ dataItems }}" selectionBehavior="Press"
    itemSelected="itemSelected" >
        <lv:RadListView.itemTemplate >
                   <Image src="{{sourceProperty, localPathVar + '/' + receivedImage}}"      />

  2. Answer
    nikolay.tsonev avatar
    340 posts

    Posted 24 Aug 2017 Link to this post

    Hi Dimitar,

    In this case, you could set a single value to the observable object, which contains the needed path.
    Regarding that, with the help of $parents property, you could access in the XML the RadListView parent bindingContext. Then we could use the path, without the need to set it inside the observable-array.
    <Page xmlns:navigation="navigation/example-page" loaded="onPageLoaded" xmlns:lv="nativescript-telerik-ui-pro/listview" xmlns="">
        <lv:RadListView items="{{ dataItems }}" >
                <StackLayout orientation="vertical">
                    <Label fontSize="20" text="{{ itemName }}"/>
                    <Label text="{{ $parents['RadListView'].testParam, $parents['RadListView'].testParam }}" textWrap="true" />
                    <Label fontSize="14" text="{{ itemDescription }}"/>

    import {ObservableArray} from "data/observable-array";
    import {Observable} from "data/observable";
    var tmpObservbale:Observable;
    export function onPageLoaded(args){
        var page = args.object;
        var array = new ObservableArray();
        array.push({itemName:"name1", itemDescription:"description1"});
        array.push({itemName:"name2", itemDescription:"description2"});
        array.push({itemName:"name3", itemDescription:"description3"});
        tmpObservbale = new Observable();
        tmpObservbale.set("dataItems", array);
        tmpObservbale.set("testParam", "This is test String");
        page.bindingContext = tmpObservbale;

    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.
  3. Dimitar
    Dimitar avatar
    66 posts
    Member since:
    May 2014

    Posted 24 Aug 2017 Link to this post

    Thank you again  for the brilliant support 
  4. Ella
    Ella avatar
    1 posts
    Member since:
    Sep 2017

    Posted 29 Sep 2017 Link to this post

    I think what brilliant support !
Back to Top