ajax 成功时为 jqxDropDownlist 设置值

set value for jqxDropDownlist when ajax success

我有这样的 jqxDropDownlist

var source = {
    datatype: “json”,
    datafields: [{ name: 'title'}, { name: 'id'}],
    id: ‘id’,
    url: “getOnvaneOrganizations”,
    async: true
};
var dataAdapter = new $.jqx.dataAdapter(source);
$(“#slc_onvane_organization_sabt”).jqxDropDownList({
    selectedIndex: 0,
    source: dataAdapter,
    displayMember: “title”,
    valueMember: “id”,
    theme: ‘darkblue’,
    filterable:true,
    width:’100%’,
    rtl:true
});
$(“#slc_onvane_organization_sabt”).jqxDropDownList(‘val’,’10′);

因为异步为真,所以 $("#slc_onvane_organization_sabt").jqxDropDownList('val','10'); 运行 秒之前 ajax 成功,但没有成功。

运行 $("#slc_onvane_organization_sabt").jqxDropDownList('val','10'); 在 ajax.success 中如何发挥作用?

请帮帮我

jqxDataAdapter: downloadComplete(edata, textStatus, jqXHR): A callback function which is called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing jqxDataAdapter

对于像 jqxdropdownlist 这样的其他元素有 bindingComplete

This event is triggered when the data binding operation is completed. Code example

Bind to the bindingComplete event by type: jqxDropDownList.

$("#jqxDropDownList").on('bindingComplete', function (event) { });

Try it: Bind to the bindingComplete event by type:jqxDropDownList

然后使用此代码可以在 bindingComplete

时更改 jqxDropDownList 的值
$("#slc_onvane_organization_sabt").on('bindingComplete', function (event) { 
        $("#slc_onvane_organization_sabt").jqxDropDownList('val','10');
 });