Oracle Apex 4.2和Oracle 12c
例如。
Within apex plsql region I have this code to creating drop down list
<button id="Clickme" onclick="myFunction()">Click me</button>
<br>
<select name="F01" class="mySelect">
<option value="0"></option>
<option value="1">Yes</option>
<option value="2">No</option>
</select><br>
<select name="F01" class="mySelect">
<option value="0"></option>
<option value="1">Yes</option>
<option value="2">No</option>
</select><br>
<select name="F01" class="mySelect">
<option value="0"></option>
<option value="1">Yes</option>
<option value="2">No</option>
</select><br>
<select name="F01" class="mySelect">
<option value="0"></option>
<option value="1">Yes</option>
<option value="2">No</option>
</select>
等等
在页面加载标题之后我有一个创建localsession的进程,因为默认值应该来自db表
例如。
localStorage.setItem('SetDefaults','[{"id":"1","attribute1":"Yes"},{"id":"2","attribute1":"Yes"},{"id":"3","attribute1":"N/A"},{"id":"4","attribute1":"N/A"}]');
因此,当页面加载时,所有下拉列表都为空,但是当单击“按钮”时,下拉项目应根据上述localStorage数据显示默认值。我在页面上有5列的原因,每列与第1列相同,但应根据按钮显示不同的数据。
请帮忙吗?
答案 0 :(得分:0)
- 一些HTML代码 - //下拉列表类'Listcls'
<select name="F03" class="selectlist Listcls " "="" size="1" data-obs="1">
<option value=""></option>
<option value="Yes">Yes</option>
<option value="No">No</option>
<option value="N/A">N/A</option>
</select>
- 单击按钮时获取默认值的javascript代码但是我无法确定如何在单击按钮时显示json值。
// Button class 'BtnCls'
$('.BtnCls').on('click', function() {
var vdef = [{"id":"1","attribute1":"Yes"},{"id":"2","attribute1":"Yes"},{"id":"3","attribute1":"N/A"},{"id":"4","attribute1":"N/A"},{"id":"5","attribute1":"N/A"},
{"id":"6","attribute1":"N/A"},{"id":"7","attribute1":"N/A"},];
var vdefault = JSON.parse(JSON.stringify(vdef));
for (var i = 0; i < vdefault.length; i++) {
var obs = vdefault[i].attribute1;
// dropdown list class 'Listcls'
// $('.Listcls').css('background-color', 'grey'); -- working for testing
}
});