This is a migrated thread and some comments may be shown as answers.

Property 'selected' does not exist on type 'RadListView'.

1 Answer 174 Views
ListView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Anurag
Top achievements
Rank 1
Anurag asked on 11 Jul 2017, 12:59 PM

Hi

Am just trying to upgrade my angular nativescript project to Nativescript 3.0. While executing tns run android I get an error 

Property 'selected' does not exist on type 'RadListView'.

The relevant lines from my code are

public itemSelected(args: ListViewEventData) {

var item = this.dataItems.getItem(args.index);

item.selected = true;

}

Please help.

    

1 Answer, 1 is accepted

Sort by
0
Nick Iliev
Telerik team
answered on 11 Jul 2017, 01:55 PM
Hello Anurag,

The error indicates that you are accessing custom property selected on the current item which is not existent
Based on the snippet you are getting the current item by using the index (args.index) to access the data source behind the current item. However, we have no information what this.dataItem.getItem(args.index) is as object structure.

For example, it could be something like:
var item = this.dataItems.getItem(args.index)l
 
// does item have selected property?
// item = { name: "John", score: 42 }
// or
// item = { name: "John", score: 42, selected: false }

As a side note with nativescript-telerik-ui version 3.0.1 we could use getSelectedItems method as described in this documentation article and as shown in these examples.

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.
Tags
ListView
Asked by
Anurag
Top achievements
Rank 1
Answers by
Nick Iliev
Telerik team
Share this question
or