Can I save the lightbox without exiting

I want to be able to click save in the lightbox without it returning to the calendar.

That way I can click on a custom button that uses the event id

I can’t force the user to exit and re-enter the screen to press the button.

TIA

David

Hi,

if you use a custom lightbox your can disable the call of the “scheduler.endLightbox(true, custom_form);” when click on “Save” button.
docs.dhtmlx.com/scheduler/custom … _form.html

a sample with a custom lightbox:
docs.dhtmlx.com/scheduler/sample … _form.html

There must be a simple way to intercept the save button so that it doesn’t close the event edit lightbox dialog.

I have a bunch of fields in my lightbox. So creating a custom lightbox is an issue (since I have to write code to save values now…)

It just needs to save and not close.

I don’t mind adding buttons or links if that’s a way to do it.

TIA

-D

You can add or change buttons in the lightbox

docs.dhtmlx.com/scheduler/changi … ttons.html

Ok. I guess I have to figure out which API call will work.

Thanks,

-D

With above linked code, you can set a custom buttons for lightbox instead of default save button. And for custom buttons you can have your own processing logic, which can trigger data saving without closing lightbox. Or, you can just call something like

scheduler.endLightbox(true); scheduler.showLightbox(id);

It will close lightbox, start data saving and reopen the lightbox again.

That should do the trick. Will try that now.

Thanks so much,

David

When I add your code it freezes. After I refresh I notice that it added the event.

I modified it to get the id, but that doesn’t help either.

I’m wondering what I can do to make it work?

TIA,

David

    scheduler.attachEvent("onLightboxButton", function(button_id, node, e){ 
                                                                                                                                                            
        if(button_id == "save_button"){                                     
            scheduler.endLightbox(true);                                    
            var id = scheduler.getState().select_id;                        
            scheduler.showLightbox(id);                                     
        }

It hangs on the endLightbox?

-D

Do you have any kind of online demo or a sample where problem can be checked ?

The above code looks fine for me. Similar one works correctly locally.

I will see if I can give access to the program.

When I use your code is doesn’t have the ID so it complains.

Once I give it access to the id it complains with the following message

-D

TypeError: f is undefined

…("#")!=-1;d&&(g=a.split("#")[0]);var h=function(a){var b=c.getEvent(a);b._end_da…

dhtmlx…ring.js (line 21)


function(a){return a.toString().indexOf("#")==-1};c.showLightbox_rec=c.showLightbox;c.showLightbox=function(a){var b=this.locale,e=c.config.lightbox_recurring,f=this.getEvent(a),g=f.event_pid,d=a.toString().indexOf("#")!=-1;d&&(g=a.split("#")[0]);var h=function(a){var b=c.getEvent(a);b._end_date=b.end_date;b.end_date=new Date(b.start_date.valueOf()+b.event_length*1E3);return c.showLightbox_rec(a)};if((g||g==0)&&f.rec_type)return h(a);if(!g||g==0||!b.labels.confirm_recurring||e==“instance”||e==“series”&&

Your code didn’t work because ‘id’ wasn’t defined.

I gave it a function to get the id but it returns null after the endLightbox(true)

So then it trips up after that…

-D

Notes:

     scheduler.attachEvent("onLightboxButton", function(button_id, node, e){  
                                                                              
         if(button_id == "update_button"){                                    
             scheduler.endLightbox(true);                                     
             var id = scheduler.getState().select_id;                         

console.log(id);
scheduler.showLightbox(id);
}

RE: can’t create a button in the lightbox that saves without ending up on the calendar page (like the default save does). tried the endLightbox but that doesn’t work. and even if so I can’t get the id for the showLightbox

Help!

Not sure why endLightbox doesn’t work?

No Javascript errors…

-D

Here are my issues:

  1. the endLightbox saves the record but doesn’t close the default form
<?xml version='1.0' ?>

(14942 is the my event id to the created events record)

  1. the recurring include causes exceptions (remove temporarily)
  2. I’m not able to get the id so I have no parameter for the showLightbox even if the endLightbox worked…

scheduler.attachEvent(“onLightboxButton”, function(button_id, node, e){

  if(button_id == "update_button"){                                     
      scheduler.endLightbox(true); // DOESN'T CLOSE                                      
      scheduler.showLightbox(id); // WHERE CAN I GET THE ID FROM?                             

// all these get null wherever I put them
// var id = scheduler.getState().select_id;
// var ev = scheduler.getEvent(scheduler.getState().lightbox_id);
// scheduler.cancel_lightbox_origin();
// console.log(ev.event_id);
}

Hi,
please try this method:

scheduler.config.buttons_left=["dhx_save_btn","dhx_cancel_btn","save_not_close_button"]; scheduler.locale.labels["save_not_close_button"] = "Save not close"; scheduler.attachEvent("onLightboxButton", function(button_id, node, e){ if(button_id == "save_not_close_button"){ var eventId = scheduler.getState().lightbox_id; scheduler.save_lightbox(); scheduler.showLightbox(eventId); } });

Thanks so much, but still pending issues.

If I include the recurring module there’s and error (pls. see below)

I’m not able to close and re-open the lightbox automatically (some of my links are generated with the event id which I’m not able to get after saving yet)

I appreciate your attention.

-D

// cancel button

TypeError: b is undefined

…a){a.event_length=(a.end_date.valueOf()-a.start_date.valueOf())/1E3;a.end_date=a…

dhtmlx…ring.js (line 20)

for(var j=!1,l=0;l<this._rendered.length;l++)this._rendered[l].getAttribute(“event_id”)==a&&(j=!0);if(!j)this._select_id=null}return!0});c.attachEvent(“onEventAdded”,function(a){if(!this._loading){var b=this.getEvent(a);b.rec_type&&!b.event_length&&this._roll_back_dates(b)}return!0});c.attachEvent(“onEventSave”,function(a,b){var c=this.getEvent(a);if(!c.rec_type&&b.rec_type&&(a+"").indexOf("#")==-1)this._select_id=null;return!0});c.attachEvent(“onEventCreated”,function(a){var b=this.getEvent(a);if(!b.rec_type)b.rec_type=

I think this it’s almost working.

I need a key value that I get from getEvent

Then I can use that value to create a location call

But for some reason I can access some values of the getEvent object and other’s not. Or if I access the id, which is the event_id I’m looking for it gives me the lightbox_id. Or sometimes it has nothing and other times it’s full?

I dumped the value of the object below.

How can I get the ‘id’ value? I have tried temp.id, temp[‘id’]…

TIA,

David

Notes:

cancel_reason
“”

canceled
0

dhx_editor_status
“”

division
“AA”

end_date
Date {Wed Apr 09 2014 13:10:00 GMT-0400 (Eastern Standard Time)}

event_type
“other”

id
“15019” <<<< I WANT TO GET THIS VALUE???

is_private
0

media_type
undefined

reminder_flag
0

start_date
Date {Wed Apr 09 2014 13:05:00 GMT-0400 (Eastern Standard Time)}

text
“New event type”

Code:

if(button_id == “save_not_close_button”){
var eventId = scheduler.getState().lightbox_id; // works
scheduler.save_lightbox(); //works
scheduler.showLightbox(eventId); // works

  var temp = scheduler.getEvent(eventId);                         
  console.log(temp);     // shows the output above                                         
  console.log(temp['id']);  // shows the lightbox id ???                                      

}

The other odd behavior is that the newly created record only has a cancel button on it.

-D

Hi,
when the event is saved it changes its ID, but the lightbox is open for old ID. I think this can’t be solved without changing the private properties (in general it’s not so good…):

[code]scheduler.config.buttons_left=[“dhx_save_btn”,“dhx_cancel_btn”,“save_not_close_button”];
scheduler.locale.labels[“save_not_close_button”] = “Save not close”;
scheduler.attachEvent(“onLightboxButton”, function(button_id, node, e){
if(button_id == “save_not_close_button”){
var eventId = scheduler.getState().lightbox_id;
scheduler.save_lightbox();
scheduler.showLightbox(eventId);
}
});

scheduler.attachEvent(“onEventIdChange”, function(old_id,new_id){
if(scheduler._lightbox_id) // if lightbox is open
scheduler._lightbox_id = new_id;
});[/code]

Fantastic!!! Save button working

One more minor issue and then I should be over the hump. After I save I’m not getting the select_id without re-entering the lightbox.

I am trying to create a dynamic link off that value.

Thanks sooo much,

David

Notes:

show mode

After saving…

The new_id gives me null?

-D

var link7 = “show id is null”;

return “

” + link7 + “
”;