State Persistence
28 Jun 2017 / 2 minutes to read
DropDownList stores its model is local storage by defining the property enablePersistence.
You can sustain the below given functionalities in DropDownList by enabling persistence property,
- selected items value in the textbox
- item’s selection state in the popup list
Widget model will be stored in local storage / cookies of browser before page refreshes and reinitialized with the restored model after refresh.
The following properties are not included while maintaining DropDownList’s state in local storage to keep localStorage compact.
- Fields
- Data source
- Query
<form id="form1">
<input type="text" id="dropdown1" ej-dropdownlist e-datasource="data" e-fields-text="text" e-fields-value="value" e-enablepersistence="true" />
<input type="button" onclick="myFunction()" value="Submit form">
</form>
var items = [{
text: "Adams",
value: "emp1"
}, {
text: "James",
value: "emp2"
}, {
text: "Maria",
value: "emp3"
}, {
text: "Jessica",
value: "emp4"
}, {
text: "jenneth",
value: "emp5"
}];
angular.module('dropdownlistApp', ['ejangular'])
.controller('dropdownlistCtrl', function ($scope) {
$scope.data = items;
});
function myFunction() {
document.getElementById("form1").submit();
}
Was this page helpful?
Yes
No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page