Перейти к основному содержимому

updateCollection

Description

Обновляет указанную коллекцию новыми опциями

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

Parameters

  • collection - (required) string - имя коллекции для обновления
  • options - (required) array - новые значения коллекции

Returns

  • collection - (boolean) - true, если обновление прошло успешно; false, если коллекция не найдена

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.
  • Коллекции могут быть изначально созданы с помощью метода serverList.

Примеры

Select control

Рассмотрим lightbox, настроенный следующим образом:

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

С такой настройкой можно обновлять опции в select контроле, изменяя список с именем 'sections'.
Для обновления списка 'sections' можно выполнить следующее:

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

Units view

Предположим, у вас есть Units view, настроенный так:

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.