search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Scheduler MVC - Hiding rows without events

Asked by Don Krause
7 years ago.

I'm trying to hide rows without events in an MVC scheduler. I found an example on how to do this but it dosen't work for MVC. I get a javaScript error 'isEmpty() is not a function' It seems that this js function isn't available in daypilot-all.min.js version 2717. The demo of hiding empty rows uses daypilot-all.min.js version 2773. I tried this version in my project and it won't compile. It complains that I'm using 2773 and it expected 2717.

Answer posted by Dan Letecky [DayPilot]
7 years ago.

The isEmpty() method of DayPilot.Row is available since client core version 2759. It's now available in the sandbox version of DayPilot Pro for ASP.NET MVC:

https://mvc.daypilot.org/sandbox/

The latest sandbox build (8.4.5882) now also includes RowFilterJavaScript property which translates to onRowFilter event.

The MVC version of the empty row hiding sample (https://code.daypilot.org/97960/html5-scheduler-hiding-rows-without-events) would look like this:

<div class="space"><label><input type="checkbox" id="hide"> Hide rows without events</label></div>

@Html.DayPilotScheduler("dp", new DayPilotSchedulerConfig {
  // ...
  RowFilterJavaScript="rowFilter(args);"
})

<script>
    function rowFilter(args) {
        var hideEmptyRows = args.filter;
        args.visible = !hideEmptyRows || !args.row.events.isEmpty();
    }

    $(document).ready(function () {
        $("#hide").click(function () {
            var hideEmptyRows = $(this).is(":checked");
            dp.rows.filter(hideEmptyRows);
        });
    });
</script>

Please let me know if there is any problem.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.