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

Resource Header Click - JavaScript

Asked by Anonymous
10 years ago.

Hello,

i got the following problem. I want that when i User click on a resource a JavaScript is WITH parameters (which item did he click) is executed. Thats what i got so far. It works fine but without any information on which item the User clicked

....ResourceHeaderClickJavaScript="test()" ResourceHeaderClickHandling="JavaScript" ...

<script language="javascript">
function test() {
alert("test")
}
</script>

I know how it works in the Code behind (c#) but i want to handle it with javaScript and not with PostBack.

thx for the help.

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

The resource header details are accessible using "resource" variable:

DayPilot Scheduler tag:
ResourceHeaderClickJavaScript="test(resource);"
JavaScript:
<script language="text/javascript"> 
function test(resource) { 
  var id = resource.id;
  var name = resource.name;
  var start = resource.start; // will be different from StartDate in Days mode
  alert("Clicked: " + name);
} 
</script>
Comment posted by Anonymous
10 years ago.

Yes, this works perfect.
The important thing is to call the parameter exactly resource (like in the example above).

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