updateCollection

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

boolean updateCollection(string collection,array options);
collectionstring要更新的 collection 名称
optionsarraycollection 的新值列表
booleantrue,如果更新成功;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" }
]);
See also
返回顶部