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

Resource row clikc/double-click issue

Asked by Ed
20 days ago.

Hi,

ASP.net webforms DP scheduler - trying to implement row double-click functionality. Just testing at the moment but am getting an “unexpected token ‘$’, “$$$System.”… is not valid JSON” error.

Markup:

RowClickHandling="Callback"

OnRowClick="dpsAcView_RowDoubleClick"

code-behind:

Protected Sub dpsAcView_RowDoubleClick(sender As Object, e As RowClickEventArgs)

Dim resourceId As String = e.Resource.Id

Dim resourceName As String = e.Resource.Name

Dim alertText As String = resourceId & " " & resourceName

dpsAcView.UpdateWithMessage(alertText)

End Sub

From a context menu on the same row (set up to pop a js alert box) I am getting the id and name values. If I set up another context menu (“test” in this example) and call a js function that does commandCallBack I can pass the row id to the “command” sub in the code-behind and use it (for test purposes I was displaying it using “.UpdateWithMessage”:

Markup:

<DayPilot:MenuItem Action="JavaScript" JavaScript="resourceCommand(e.value)" Text="test" />

js:

function resourceCommand(resourceId) {

dpsAcView.commandCallBack("test", { id: resourceId });

}

c-b:

Protected Sub dpsAcView_Command(sender As Object, e As CommandEventArgs)

select case e.Command

case “test”

Dim resourceId As String = CStr(e.Data("id"))

dpsAcView.UpdateWithMessage(resourceId)

However, no combination of code seems to work for clicking or double-clicking a resource row, client-side or server-side. If I change the handling to Javascript I get an “args not defined” or similar error:

Markup:

RowClickHandling="Javascript"

RowClickJavaScript="onRowDoubleClick(e.value())"

js:

function onRowDoubleClick(rowId) {

alert("Double-clicked resource row: " + rowId);

}

Error: e is not defined (it throws an “args not defined” if I replace e.value() with anything that has “args” in it).

Any ideas? Thanks - EW

Answer posted by Dan Letecky [DayPilot]
17 days ago.

Hi Ed,

I did a couple of tests to check the issues.

1. The RowClick event seems to work fine like this:

RowClickHandling="Callback"
OnRowClick="DayPilotScheduler1_OnRowClick"

Code behind (C#):

protected void DayPilotScheduler1_OnRowClick(object sender, RowClickEventArgs e)
{
  DayPilotScheduler1.UpdateWithMessage("row click: " + e.Resource.Id);
}

2. When handling RowClick on the client side, you need to use the row object instead of e.

RowClickHandling="JavaScript"
RowClickJavaScript="alert(row.id)"

3. The RowDoubleClick event is not supported on the server side (CallBack, PostBack). But you can handle it on the client side like this:

RowDoubleClickHandling="JavaScript"
RowDoubleClickJavaScript="alert(row.id)"

Instead of handling double click, you can also add a clickable icon to the row header using an active area in BeforeResHeaderRender (to provide a visual hint). An example:

protected void DayPilotScheduler1_BeforeResHeaderRender(object sender, DayPilot.Web.Ui.Events.Scheduler.BeforeResHeaderRenderEventArgs e)
{
  e.Areas.Add(new Area().Width(17).Bottom(0).Right(0).Top(0).Image("../icon.png").JavaScript("alert(e.id)"));
}

In the Area.JavaScript() method, the object is always available as e (even for rows).

Please let me know if it didn’t help.

Comment posted by Ed
15 days ago.

Hi Dan,

OK, thanks for the quick reply - don’t know what I was doing wrong before but yep, using row.id to a JavaScript function works as expected :)

New Reply
This reply is
Attachments:
or drop files here
Your name (optional):