jQWidgets Forums
jQuery UI Widgets › Forums › Plugins › AngularJS › Change Label of ListBox dynamically
This topic contains 2 replies, has 2 voices, and was last updated by karthick singh 10 years, 6 months ago.
Viewing 3 posts - 1 through 3 (of 3 total)
-
Author
-
Hi,
When i type something in the textbox and press submit button,the entered value must be set in my span tag.
How can i achieve this?<div ng-app="listApp" ng-controller="listController"> <a href="" data-ng-click="changeValues(value)"> <img src="Refresh.jpg"> </a>Refresh <jqx-list-box jqx-ng-model="newValue" id="jqxlistbox"></jqx-list-box> <input type="text" ng-model="value"/> </div>
var demoApp = angular.module("listApp", ["jqwidgets"]); demoApp.controller("listController", function ($scope) { $scope.ListSource = [{ html: '<div><img width="110" height="100" src="admin.jpg"/></div> ' + '<div style="width:100px;height:20px;border: thin solid black">' + '<span style="width:50px;height:20px;float: left;border-right-style: groove">'+$scope.newValue+'</span>' + '<span style="float: right;"></span></div>'}, {html: '<div><img width="110" height="100" src="admin.jpg"/></div>'}, {html: "<div><img width='110' height='100' src='admin.jpg'/></div>"}]; $scope.changeValues = function(value){ $scope.newValue = value; console.log($scope.newValue); }; $("#jqxlistbox").jqxListBox({source: $scope.ListSource, width: "10%", height:300 }); });
Hi karthick singh,
Please, find below an example which shows how to dynamically update ListBox item as you type in a TextBox:
<!DOCTYPE html> <html ng-app="demoApp"> <head> <title id="Description">jqxListBox directive for AngularJS</title> <link rel="stylesheet" type="text/css" href="../../jqwidgets/styles/jqx.base.css" /> <script type="text/javascript" src="../../scripts/angular.min.js"></script> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxangular.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxinput.js"></script> <script type="text/javascript" src="../../scripts/demos.js"></script> <script type="text/javascript"> var demoApp = angular.module("demoApp", ["jqwidgets"]); demoApp.controller("demoController", function ($scope) { $scope.people = ["Pedro", "Clara", "John", "Pier"]; // init ListBox's settings object. $scope.listBoxSettings = { width: 200, height: 200, source: $scope.people } }); </script> </head> <body> <div ng-controller="demoController"> <jqx-list-box jqx-settings="listBoxSettings"></jqx-list-box> <br /> <jqx-input ng-model="people[0]"></jqx-input> </div> </body> </html>
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter…
Thanks for your reply..But i need to achieve the same for LISTBOX WITH IMAGES… Can you please tell me where i missed in my sample, and why i am not able to achieve in my sample…
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.