Dojo 从Dijit/form/Select获取selectedIndex时出现问题

Dojo 从Dijit/form/Select获取selectedIndex时出现问题,dojo,Dojo,我正在jsp页面上将Dojo从1.4升级到1.8 <div data-dojo-type="dijit/layout/BorderContainer" gutters="false" style="margin-left: 0px; margin-top: 2px; margin-bottom: 2px"> <select name="<%=inputName%

我正在jsp页面上将Dojo从1.4升级到1.8

<div data-dojo-type="dijit/layout/BorderContainer" gutters="false"
                            style="margin-left: 0px; margin-top: 2px; margin-bottom: 2px">
                            <select name="<%=inputName%>"
                                id="XX.AddNewDocument.<%=panelName%>.<%=inputName%>"
                                jsId="XX.AddNewDocument.<%=panelName%>.<%=inputName%>"
                                onKeyPress="handleSearchPanelInputKeyDown"
                                onBlur="handleSearchPanelInputLostFocus"
                                onFocus="handleSearchPanelInputGetFocus"
                                onChange="onChangeLinkedField(this)"
                                <%
            String dataSourceUrl = inputConfig.getPicklistUrl();
                                        System.out.println("Jaya6 dataSourceUrl "+dataSourceUrl);
            boolean hasDataSource = dataSourceUrl != null && dataSourceUrl.length() > 0;
            if (hasDataSource) {
                %>
                                store="<%=uiModel.getInputDataStoreId(panelName, inputName)%>"
                                <%
            }
            if (inputConfig.isHidden()) {
                %>
                                style="visibility: hidden;" <%
            }
                %>
                                data-dojo-type="dijit/form/Select" inputWidth="168" 
                                style="width:186px;margin:2px;" maxHeight="200"
                                sortByLabel=true>
                                <%
但是srcField.selectedIndex返回null。我想得到所选值的索引

请帮我拿同样的


提前谢谢

嘿,你可以试试这个替代品

this.onChangeLinkedField = function (srcField) {

    this.store.get(srcField).then(
       function(response){
            console.log(response); // result object{} contain id and data
    });
    this.changeLinkedField(srcField);
}
我希望这对你有帮助。
谢谢

您是否尝试通过控制台srcField查看它在选择值或对象时返回的内容?srcField将返回从dijit/form/selects中选择的值非常感谢您的回复。我正在获取存储,因为上面提到的未定义代码位于不同的文件Mithlesh中,您能提供解决方案吗?嘿,我不熟悉Java,所以我不了解如何在选择框中填充数据。要将数据连接到
dijit/form/Select的存储,您需要
dojo/store/Memory
dojo/store/JsonRest
。另一种选择是,您只需尝试
this.options
提供给您的内容。this.options未定义。但是这段代码在dojo 1.4srcField.options中使用的是4个对象(可能是因为当前有4个值)
this.onChangeLinkedField = function (srcField) {

    this.store.get(srcField).then(
       function(response){
            console.log(response); // result object{} contain id and data
    });
    this.changeLinkedField(srcField);
}