Articles in this section
Category / Section

Load a dynamic list item in child page in JavaScript ListView.

1 min read

To load the dynamic list item in the child page externally, you can append the listview on demand in the child page of the list item in JavaScript ListView. Refer to the following steps to achieve this.
Since the child list items have to be loaded on demand, you need to write the bind touch event for the list item that needs to be loaded dynamically. The following code example displays the same.

HTML

<div data-role="ejmnavigationdrawer" id="navpane" data-ej-targetid="defaultswipe" data-ej-listviewsettings-datasource="lData" data-ej-listviewsettings-touchstart="touch" />


On touchstart event, you can initiate the required listview with remote databinding. For that, append the listview wrapper in the child list items and initiate the same in the obtrusive way as given in the following code.

<script>
// On touch start of the listview.

function touch(args) {

// DataManager creation.

window.datasource = ej.DataManager({

url: "https://mvc.syncfusion.com/Services/Northwnd.svc/"

});

window.dbitem = { "text": "ShipCity" };

//Creates the div tag with child listview ID.

var list = ej.buildTag('div#' + $(args.item).attr('data-childid') + "_list");

//Appends the children list under the div ID "child_container".

$('#' + $(args.item).attr('data-childid') + "_container").empty().append(list);

//Initializes the child list.

list.ejmListView({ dataSource: window.datasource, fieldSettings: window.dbitem, query: "ej.Query().from('Orders').select('ShipCity').take(5)" })
}
<script>

 

Thus you can load the list item dynamically with remote databinding in the child page.


Conclusion

I hope you enjoyed learning about how to load a dynamic list item in child page in JavaScript ListView.

You can refer to our JavaScript ListView feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript ListView example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied