[英]Populating dropdown field with text when a row is selected
I have HTML where I am trying to populate a drop-down with string data using jQuery when an item is selected from a drop-down. 我有HTML,当我从下拉列表中选择一个项目时,我正在尝试使用jQuery使用字符串数据填充下拉列表。
<td class="col-md-3" colspan="4">
<label class="control-label">{{item.fields[11].displayName}}22</label>
<div class="dropdown" style="width:100%">
<input type="text" class="form-control dropdown-toggle" data-toggle="dropdown" data-ng-disabled="formReadOnly" data-ng-model="item[item.fields[11].name]" data-ng-keyup="comboBoxGenOptions(2, 148, item[item.fields[11].name], 'searchGenericOptions')" />
<ul class="dropdown-menu" style="width:100%">
<li class="GpiId" data-ng-repeat="name in searchGenericOptions" style="width:100%"><a data-ng-click="changeData(item.fields[11].name, name)">{{name}}</a></li>
</ul>
</div>
<label class="error" data-ng-show="issueSuppNum()">Please insert a valid generic name.</label>
@*<div class="GenId" data-strat-form-control data-field-display-id="1" data-vmformreadonly="formReadOnly" data-show-tool-tip="showToolTip(item.fields[7].htmlName)" data-strat-model="item" data-field="item.fields[7]"></div>*@
</td>
The drop down populates with an object: 下拉列表中填充了一个对象:
When I click it, I want to show the GPI field: 单击它时,我要显示GPI字段:
$scope.changeData = function (propertyName, name) {
$scope.item[propertyName] = name;
$('GpiId').text(name.GPI);
};
The objects are being pulled on correctly: 对象被正确拉上:
What am I doing wrong and how do I fix it? 我在做什么错,我该如何解决?
Edit: added class to field. 编辑:将类添加到字段。
First, I think you missed a "." 首先,我认为您错过了“。” in your class selector.
在您的班级选择器中。
$('GpiId').text(name.GPI);
to 至
$('.GpiId').text(name.GPI);
Second, since you are already using angular, I would try to use {{}} within GpiId instead. 其次,由于您已经在使用angular,所以我会尝试在GpiId中使用{{}}。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.