翻譯|使用教程|編輯:董玉霞|2022-04-02 17:08:45.670|閱讀 260 次
概述:DhtmlxGantt的資源控制,用于將多個資源及其數量分配給任務的復雜控件。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
此功能僅在 Gantt PRO 版本中可用。
DhtmlxGantt的資源控制,用于將多個資源及其數量分配給任務的復雜控件。
gantt.config.lightbox.sections = [ {name: "description", height: 38, map_to: "text", type: "textarea", focus: true}, {name:"owner",height:60, type:"resources", options:gantt.serverList("people"), map_to:"owner_id", default_value:8}, {name: "time", type: "duration", map_to: "auto"} ];
分配多個資源
gantt.config.lightbox.sections = [ { name:"description",height:38,map_to:"text",type:"textarea",focus:true }, { name:"time",type:"duration",map_to:"auto" }, { name:"rooms",type:"resources",map_to:"rooms", options:[ { key: 1, label: "room 1", unit: "hours" }, { key: 2, label: "room 2", unit: "hours" }, { key: 3, label: "room 3", unit: "hours" } ] } ]; gantt.locale.labels.section_rooms = "Rooms";
要將資源控件添加到燈箱,請按照以下步驟操作:
在燈箱配置中添加一個部分:
var roomsMap = [ { key: 1, label: "room 1", unit: "hours" }, { key: 2, label: "room 2", unit: "hours" }, { key: 3, label: "room 3", unit: "hours" } ]; gantt.config.lightbox.sections = [ { name:"description",height:38,map_to:"text",type:"textarea",focus:true }, { name:"time",type:"duration",map_to:"auto" }, { name:"rooms",type:"resources",map_to:"rooms", options:roomsMap} ];
為部分設置標簽:
gantt.locale.labels.section_resources = "Rooms";
以下屬性最重要且通常用于資源控制:
通常,要設置資源控制的值,請使用options參數:
gantt.config.lightbox.sections = [ { name:"rooms",type:"resources",map_to:"rooms", options:[ { key: 1, label: "room 1", unit: "hours" }, { key: 2, label: "room 2", unit: "hours" }, { key: 3, label: "room 3", unit: "hours" } ] } ];
options參數中的項目具有 3 個強制屬性:
要從服務器填充控件,請將options選項設置為serverList方法返回的值:
gantt.config.lightbox.sections = [ {name: "description", height: 38, map_to: "text", type: "textarea", focus: true}, {name: "resources", type: "resources", map_to: "owner_id", default_value:8, options: gantt.serverList("people")}, {name: "time", type: "duration", map_to: "auto"} ]; gantt.init("gantt_here"); gantt.load("/data");
更多關于DhtmlxGantt教程的內容可進入官網查看。
DhtmlxGantt是針對您的解決方案的交互式JavaScript / HTML5甘特圖。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn