跳转到主要内容

updateCollection

Description

使用新的选项更新指定的 collection

updateCollection: (collection: string, options: any[]) => boolean

Parameters

  • collection - (required) string - 要更新的 collection 名称
  • options - (required) array - collection 的新值列表

Returns

  • collection - (boolean) - true,如果更新成功;false,如果未找到该 collection

Example

scheduler.config.lightbox.sections=[   
{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
{name:"items", height:23, type:"select",
options:scheduler.serverList("goods", goods_array), map_to:"section_id" },
{name:"time", height:72, type:"time", map_to:"auto"}
];

Details

  • 此方法会触发 onOptionsLoad 事件并刷新 lightbox。
  • Collections 可通过 serverList 方法初始创建。

示例

Select 控件

假设有如下配置的 lightbox:

scheduler.config.lightbox.sections = [
{ name: "description", ...},
{ name: "sections", type: "select", options: scheduler.serverList("sections"), /*!*/
map_to: "section_id" },
{ name: "time", ... }
];

通过此配置,可以通过修改名为 'sections' 的列表来更新 select 控件中的选项。
要更新 'sections' 列表,可以执行如下操作:

scheduler.updateCollection("sections", [
{ key: 5, label: "Section E" },
{ key: 6, label: "Section F" },
{ key: 7, label: "Section G" }
]);

Units 视图

假设有如下配置的 Units 视图:

scheduler.createUnitsView({
name: "unit",
property: "section_id",
list: scheduler.serverList("sections") /*!*/
});

要更改显示的单位列表,可以使用:

scheduler.updateCollection("sections", [
{ key: 5, label: "Section E" },
{ key: 6, label: "Section F" },
{ key: 7, label: "Section G" }
]);
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.