Articles in this section
Category / Section

How to use getDataList method in Listbox

1 min read

This Knowledge Base explains the way to use getDataList method in Listbox component.

You can use getDataList method to get the updated data in the Listbox. If you perform any action in ListBox, you can use getDataList method to know the changes made.

HTML

  <div class="col-lg-12 control-section">
 
      <div id="listbox-control">
 
        <h4>Select your favorite car:</h4>
 
        <input id="listbox">
 
      </div>
 
      <button id= "infobtn">GetDataList</button>
 
    </div>

 

TS

// Initialize ListBox component.
 
let listObj: ListBox = new ListBox({
 
  // Set the data source property.
 
  dataSource: (data as any).info,
 
  allowDragAndDrop: true
 
});
 
listObj.appendTo("#listbox");
 
 
 
let toggleBtn: Button = new Button({ cssClass: "e-info" });
 
toggleBtn.appendTo("#infobtn");
 
 
 
toggleBtn.element.onclick = (): void => {
 
  let Data = listObj.getDataList();
 
  console.log(Data);
 
};
 
 

 

https://stackblitz.com/edit/getdatalist?file=index.ts

 

Also please refer the below UG Documentation link,

https://ej2.syncfusion.com/documentation/list-box/getting-started/

https://ej2.syncfusion.com/documentation/api/list-box/#getdatalist

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