Jimmyt1988
Jimmyt1988

Reputation: 21146

dhtmlx scheduler height issue

When I call the following with valid data the first time... all is well and the table looks great:

        <script language = "javascript">  
            scheduler.clearAll();

            scheduler.createTimelineView({ 
                section_autoheight: false, 
                name: "timeline", 
                x_unit: "day", 
                x_date: "%d", 
                x_step: 1, 
                x_size: 30, 
                x_start: 1, 
                y_unit: <?php echo json_encode($json); ?>, 
                y_property: "section_id", 
                render: "tree", 
                fit_events: true, 
                dy: 30, 
                //dx: 150, 
                second_scale:{
                x_unit: "day", 
                x_date: "%M" 
                } 
            });      

            scheduler.config.lightbox.sections = [  
                {name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
                {name:"custom", height:23, type:"timeline", options:null , map_to:"section_id" }, //type should be the same as name of the tab
                {name:"time", height:72, type:"time", map_to:"auto"}
            ];

            scheduler.init('scheduler_here',new Date(<?php echo date("Y"); ?>, <?php echo date("n") - 1; ?>, <?php echo date("j"); ?>),"timeline");

            scheduler.parse(<?php echo json_encode($scheduler); ?>, "json");
        </script>  

But when i call the same block again, the height of the x axis headings doubles. and i call again and it doubles the last double number..

Any idea what i've done wrong?

Upvotes: 1

Views: 5307

Answers (4)

Stef
Stef

Reputation: 201

Just add the property "section_autoheight : false" inside scheduler.createTimelineView. This will solve the issue.

Upvotes: 1

Paul
Paul

Reputation: 1656

if it's still helpful for somebody

'scheduler' is a global object, so when you call this block several times, it overwrites timeline view and re-initializing the scheduler each time. This is not the desired approach, and in your case it should be a reason of strange side effects.

If you need this script in order to reload events, sections of the timeline and changing active date, you can do following:

  1. put configuration that is not modified into a static part of the page
  2. specify sections of the timeline with 'scheduler.serverList' method
  3. in the reloaded code you only - update sections of the timeline with 'scheduler.updateCollection', parse events, change active date with 'scheduler.setCurrentView'

Static code:

scheduler.createTimelineView({
    section_autoheight: false,
    name: "timeline",
    x_unit: "day",
    x_date: "%d",
    x_step: 1,
    x_size: 30,
    x_start: 1,
    y_unit: scheduler.serverList("timeline", []),
    y_property: "section_id",
    render: "tree",
    fit_events: true,
    dy: 30,
    //dx: 150,
    second_scale:{
        x_unit: "day",
        x_date: "%M"
    }
});
scheduler.config.lightbox.sections = [
    {name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
    {name:"custom", height:23, type:"timeline", options:null , map_to:"section_id" }, //type should be the same as name of the tab
    {name:"time", height:72, type:"time", map_to:"auto"}
];

scheduler.init('scheduler_here',new Date(),"timeline");

Reloaded code

<script language = "javascript">
    scheduler.clearAll();
    scheduler.updateCollection("timeline", <?php echo json_encode($json); ?>);
    scheduler.parse(<?php echo json_encode($scheduler); ?>, "json");
    scheduler.setCurrentView(new Date(<?php echo date("Y"); ?>, <?php echo date("n") - 1; ?>, <?php echo date("j"); ?>));

</script>

related docs:

http://docs.dhtmlx.com/scheduler/api__scheduler_serverlist.html http://docs.dhtmlx.com/scheduler/api__scheduler_updatecollection.html http://docs.dhtmlx.com/scheduler/api__scheduler_setcurrentview.html

Upvotes: 1

Yuvaraja
Yuvaraja

Reputation: 1

Otherwise you can specify the width and height of the dhtmlx mobile scheduler..as below..

dhx.ui ({ view:"window", height:300, width:300, ...
})

Link::http://docs.dhtmlx.com/touch/doku.php?id=api:module_baseview Regards, Yuvaraj

Upvotes: 0

Jimmyt1988
Jimmyt1988

Reputation: 21146

scheduler.xy.scale_height = 30;

I added this line of code; it overwrites the weird height issue. yay

Upvotes: 1

Related Questions