10944 : gridNode.Expanded = true doesnt seem to be work in Gantt_ASP?

Question

I have multiple rows on the GTP grid, where each row can have any number of child rows. It should be possible for the user to set which rows need to be expanded and which need not. However, the gridNode.Expanded = true doesnt seem to be working.
Also, its been noticed that in web component, all the rows are always collapsed when its loaded. Please provide pointers on what needs to be done.

Answer

Expanded/Collapsed state is stored in ViewState. So in order to change the client view it is not enough to set the GridNode.Expanded state.
You must instead use Gantt_ASP.Get/SetExpandedStatusForGridNode

    public bool GetExpandedStatusForGridNode(GridNode aGridNode)

Can be used in PageLoad more or less like this (This code does not check for postback so it will the effect that collapse appear not to work) 

      Gantt_ASP1.Gantt.Grid.Refresh(); // Makesure the grid is rendered and the datasources get initiated
      foreach (GridNode gn in Gantt_ASP1.Gantt.Grid.RootNodes)
      {
        Gantt_ASP1.SetExpandedStatusForGridNode(gn,true);
      }

10898 : I want to click/doubleclick on an empty spot in the chart to create a new item in Gantt_ASP.

Question

I’m currently evaluating the GTP.WEB component to visualize a online booking application. I’ve had no problem binding data and viewing it in the Gantt chart, but now I want to click/doubleclick on an empty spot in the chart to create a new item. So my question is what is the easiest way of accomplishing this? Which events should/could be used and how do I pass along the information about where in the chart I clicked?

Answer

Download the latest release 3.0.5.10 and you will have a new event on the Gantt_ASP called:

Gantt_ASP1.OnGanttRow_ClientClick

You can implement that with code looking more or less like this:

  void Gantt_ASP1_OnGanttRow_ClientClick(Gantt_ASP aGantt, GanttRowClickEventArgs e)
  {
    if (aGantt.MouseButton_ClientSide == 1 && e.ThisClickSelectedLink==null)
    {
        DataRow dr=dataSet1.Tables[“timeitem”].NewRow();
        dr[“owner”]=(e.Row.GridNode.ListItemWhenDataBound() as DataRowView)[“id”];
        dr[“start”]=aGantt.Gantt.DateScaler.PixelToTime(e.X);
        dr[“stop”]=aGantt.Gantt.DateScaler.PixelToTime(e.X).AddDays(2);
        dataSet1.Tables[“timeitem”].Rows.Add(dr);
    }
    LabelClickInfo.Text=”You clicked GanttRow with id “+((e.Row.GridNode.ListItemWhenDataBound() as DataRowView)[“id”]).ToString();
  }

This is the code currently running in the sample found here: http://www.plexityhide.nu/