$this->CalendarOptions->set("headerToolbar.left", "prev next today myCustomButton");
$this->CalendarOptions->set("customButtons", ["myCustomButton",["text" => "MyText"]]);
and in Page_Load
$this->CalendarOptions->import([
"initialView" => "dayGridWeek", // Set initial view to Year
"weekNumbers" => "true",
"businessHours" => "true",
"firstDay" => "1", //primer día, lunes
"customButtons"=>["myCustomButton",["text" => "MyText"]]
]);
With no results. I’ve tried several ways of writing the arrays… I just get a small button without text inside.
I don’t know how to do just the button text, not to mention the part of the function.Thanks
PHPMaker uses the customButtons to add the “Add Event” button, it will overwrite your setting added on server event. You better add your custom buttons on the client side so you can add the click handler also, see Calendar Report Setup → Server Events and Client Scripts → Example 5. Make sure you add your button to customButtons, don’t overwrite the “Add Event” button.
Thanks for the answer.
In one of my tries, I’ve played with that example, pero it seems not having effect.
I mean, I have in Client Scripts->Calendar Report->Client Script the next code:
but the code after inside {} seems to have no effect, I get nothing in console, the initial view is not “dayGridWeek” and I don’t get the “Testing” alert.
The 3 first lines works…
That’s why I haven’t made more test with client scripts
You did not use the “calendar” event, it won’t work without using it, your code is similar to adding custom buttom on the server side only (except that you can add the click handler now).Again, arbei wrote:
Make sure you add your button to > customButtons> , don’t overwrite the “Add Event” button.
I get an error: "Cannot convert undefined or null to object
don’t overwrite the “Add Event” button
The question is, it not seems to bo overwriten, the add button stills appear behind myButton (without text), and the click event works when I press the add button
Assume you have no JavaScript syntax errors, if event not fired, then your listener might be added later than the “calendar” event. If so, you may try move it earlier (as soon as jQuery is ready), e.g. in Page_Head server event,