Updating custom lightbox section html after init

Hi.

I have defined a couple of custom lightbox-sections in my Scheduler. One of them looks like this:

scheduler.form_blocks["event_info"] = {
	render:function(sns) {
		return event_info_html;
	},
	set_value:function(node, value, ev) {
		$("#event_name").val(value||"");
		$("#event_details").val(ev.details||"");
	},
	get_value:function(node,ev) {
		ev.details = $("#event_details").val();
		return $("#event_name").val();
	},
	focus:function(node) {
		var a = $("#event_name"); 
		a.select(); 
		a.focus(); 
	},
	button_click:function () {
		form_creation = true;
		scheduler.save_lightbox()
	}		
}

Note that I’m using JQuery selectors to fetch values from input-fields in the set- and get_value methods. In the render-function, there’s a variable called “event_info_html”, which contains the section-html as a string.

I need to update the variable event_info_html and modify the section-html. Specifically there’s a in there that I need to add more ‘s to. The problem is that the form-blocks’ render function is only called once; the first time lightbox opens. Even redeclaring the whole form-block and re-initializing scheduler completely has no effect; the lightbox looks the same as it initially did.

Is there a way for me to re-render / re-initialize the lightbox sections, so that I can modify the html somehow?

  • Thanks

You can use

scheduler._lightbox = null;

After that line, next time when lightbox form will be required - it will be rendered from the scratch.

That did the trick.

Thank you, Stanislav :c)