jqxdropdownlist 从其他 jqxdropdownlist 加载
jqxdropdownlist load from other jqxdropdownlist
我有 2 个 jqxDropDownList 项目是 equls。
我写了这段代码,但是这段代码向服务器发送了 2 个请求(相同)。
如何将项目从第一个 jqxDropDownList 复制到第二个 jqxDropDownList?
var source = {
datatype: "json",
datafields: [{
name: 'organizationName'
}, {
name: 'id'
}],
id: 'id',
url: "getOrganizationName",
async: true
};
var dataAdapter = new $.jqx.dataAdapter(source);
//people
$("#slc_organizationName_people").jqxDropDownList({
source: dataAdapter,
displayMember: "organizationName",
valueMember: "id"
});
//address
$("#slc_organizationName_address").jqxDropDownList({
source: dataAdapter,
displayMember: "organizationName",
valueMember: "id"
});
您可以尝试以下方法:
var source = {
datatype: "json",
datafields: [{
name: 'organizationName'
}, {
name: 'id'
}],
id: 'id',
url: "getOrganizationName",
async: true
};
var dataAdapter = new $.jqx.dataAdapter(source,{
loadComplete: function()
{
//address
var source2 = {
datatype: "array",
datafields: [{
name: 'organizationName'
}, {
name: 'id'
}],
id: 'id',
localdata: dataAdapter.records
};
var adapter = new $.jqx.dataAdapter(source2);
$("#slc_organizationName_address").jqxDropDownList({
source: adapter ,
displayMember: "organizationName",
valueMember: "id"
});
}
});
//people
$("#slc_organizationName_people").jqxDropDownList({
source: dataAdapter,
displayMember: "organizationName",
valueMember: "id"
});
我有 2 个 jqxDropDownList 项目是 equls。
我写了这段代码,但是这段代码向服务器发送了 2 个请求(相同)。
如何将项目从第一个 jqxDropDownList 复制到第二个 jqxDropDownList?
var source = {
datatype: "json",
datafields: [{
name: 'organizationName'
}, {
name: 'id'
}],
id: 'id',
url: "getOrganizationName",
async: true
};
var dataAdapter = new $.jqx.dataAdapter(source);
//people
$("#slc_organizationName_people").jqxDropDownList({
source: dataAdapter,
displayMember: "organizationName",
valueMember: "id"
});
//address
$("#slc_organizationName_address").jqxDropDownList({
source: dataAdapter,
displayMember: "organizationName",
valueMember: "id"
});
您可以尝试以下方法:
var source = {
datatype: "json",
datafields: [{
name: 'organizationName'
}, {
name: 'id'
}],
id: 'id',
url: "getOrganizationName",
async: true
};
var dataAdapter = new $.jqx.dataAdapter(source,{
loadComplete: function()
{
//address
var source2 = {
datatype: "array",
datafields: [{
name: 'organizationName'
}, {
name: 'id'
}],
id: 'id',
localdata: dataAdapter.records
};
var adapter = new $.jqx.dataAdapter(source2);
$("#slc_organizationName_address").jqxDropDownList({
source: adapter ,
displayMember: "organizationName",
valueMember: "id"
});
}
});
//people
$("#slc_organizationName_people").jqxDropDownList({
source: dataAdapter,
displayMember: "organizationName",
valueMember: "id"
});