gantti icon indicating copy to clipboard operation
gantti copied to clipboard

Default view on today?

Open emb03 opened this issue 11 years ago • 4 comments

How do I specify that the default view shows the current day (the white line?)

Thanks

Looks gorgeous BTW

emb03 avatar Jun 09 '13 20:06 emb03

it does this by default, i think.

cycloon avatar Aug 05 '13 13:08 cycloon

I think we can close this issue?

cycloon avatar Sep 30 '13 09:09 cycloon

I think he means the scroll bar automatically point to the current date.

antonioj1015 avatar Feb 12 '14 13:02 antonioj1015

@antonioj1015 , here's a solution

I scrolled it in JS by doing this:

index.php:

<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>

<div id="gantti">
    <?php echo $gantti ?>
</div>

js:

    $("body > div[id]").each(function() {
        var id = "#" + $(this).attr('id');

        try {
            $(id + " .today")[0].scrollIntoView();

            var scrollLeft = $(id + " .gantt-data").scrollLeft();
            var position = $(id + " .today").position().left - $(id + " .gantt-day").width() * 1;
            $(id + " .gantt-data").scrollLeft(scrollLeft + position);
        } catch (e) {
            null;
        }
    });

    $(document).scrollTop(0);

kevinawoo avatar Apr 03 '14 10:04 kevinawoo