I was using ListView and the list view items are bound to arrays obtained from server call. This was working without any problems, and still is. But I changed one of the list view to RadListView and now every time I am getting a console error:
CONSOLE ERROR file:///app/tns_modules/tns-core-modules/trace/trace.js:160:30: Binding: Property: 'title' is invalid or does not exist. SourceProperty: 'title'
Thought the list items are getting displayed and things are working as expected, but I keep getting the console error.
Here is some code for reference:
XML for the view:
<stack-layout loaded="onViewLoaded" unloaded="onViewUnloaded"
xmlns:lv="nativescript-telerik-ui/listview" >
<!-- entirety of the tab's content -->
<GridLayout>
<lv:RadListView id="lv1" items="{{notificationList}}" row="1" pullToRefresh="true" pullToRefreshInitiated="pullToRefreshInitiated">
<lv:RadListView.listViewLayout>
<lv:ListViewLinearLayout scrollDirection="Vertical" />
</lv:RadListView.listViewLayout>
<lv:RadListView.itemTemplate>
<grid-layout rows="auto, auto, auto" columns="auto, auto, *" class="topgrid">
<grid-layout row="0" colSpan="3" rows="auto" class="headingRegion" columns="auto, *, auto">
<label text="{{ico}}" class="{{class}}" col="0" rowSpan="2" row="0"/>
<label text="{{title}}" textWrap="true" margin="8" class="size16b align-center" col="1"/>
<label text="{{date}}" class="size10" col="2"/>
</grid-layout>
<label text="{{body}}" textWrap="true" class="size16" row="1" colSpan="3" />
</grid-layout>
</lv:RadListView.itemTemplate>
</lv:RadListView>
</GridLayout>
</stack-layout>
Code behind:
super.getDataFromServer(payLoad).then(data =>{
console.log("Notification Array : " + JSON.stringify(data));
var array = new ObservableArray(data["all"]);
var arrayn = new ObservableArray(data["notifications"]);
var arrayreq = new ObservableArray(data["requests"]);
let view = <View>args.object;
view.bindingContext = {notificationList:array, notiList:arrayn, requestList:arrayreq};
//loader.hide();
});
I am not able to understand if the property is invalid or does not exist then how come the view is still getting generated. Am I doing something wrong?
PS: The List is inside a TabView which is inside a SideDrawer implementation.
This error will not change or block your logic in any way but if you want to remove these error logs then you can provide both source and target for your binding. Here is how to do it in your XML
<label text="{{ title, title }}" />
Thank you for the help.
im new to nativescript
label text = "{{ title,title }}"
i dont know what is source and target here please explain in detail..
Most helpful comment
This error will not change or block your logic in any way but if you want to remove these error logs then you can provide both source and target for your binding. Here is how to do it in your XML