Search code examples
dhtmlx

Filtering events in timeline stops drawing a new event in DHTMLX


dhtmlxscheduler timeline when I use filtering

scheduler.filter_timeline = scheduler.filter_month = scheduler.filter_day = scheduler.filter_week = function(id, event) {
        // display event only if its type is set to true in filters obj
        if (rules[event.user_id]) {
                return true;
        }

        // default, do not display event
        return false;
};

drag animation (drawing a Node/session) doesn't work.
if you look at the DHTMLX_scheduler samples you will see create a new event doesn't work properly.
/samples/09_api/09_filtering_events.html


I am using Trace Skin . Every thing is working well. even light box is loading . the main problem is when I use this statement filter_timeline then Timeline drawing stop draw event.(It can also create it but the it is like transparent)


Solution

  • It is not a bug in scheduler itself, but badly written sample In code of sample, update next line

    CODE: SELECT ALL

    if (filters[event.type]) {
    

    as

    CODE: SELECT ALL

    if (filters[event.type] || event.type==scheduler.undefined) {
    

    When event just created it doesn't have the type defined yet, so it was filtered out with previous logic