custom lightbox setvalue function not working first time.

Hi,

Hope you are doing fine.

I am facing some issues with my custom Lightbox. When I double click my dhtlmxscheduler calendar first time the “setValues = function (obj) {“ method not even calling but it’s still opening the lightbox. At the same time I close the lightbox and re-Open (double click any scheduler) lightbox that time only it’s setting the values. Seems like first time not working not sure why? Is it because of dhtlmxtabBar control?

I am using MVC 4. sample code below.

1.CalendarController.cs

public ActionResult Index()
{
var sched = new DHXScheduler(this);

        sched.LoadData = true;
        sched.EnableDataprocessor = true;

        //view, width, height
        var box = sched.Lightbox.SetExternalLightbox("Appointment/Lightboxform ", 420, 195); -- This is different controller.
        //css class to be applied to the form
        box.ClassName = "custom_lightbox";
        sched.InitialDate = new DateTime(2011, 9, 5);

        //try in new skin
        //sched.Skin = DHXScheduler.Skins.Terrace;

        return View(sched);
    }

public ContentResult Data()
{
var data = new SchedulerAjaxData((new DHXSchedulerModelsDataContext()).Events);

        return (data);
    }
  1. AppointmentController.cs
    public ActionResult Lightboxform()
    {

         return View(); 
     }
    

public ActionResult OpenAppointment()
{
return view()
}

  1. Lightboxform.cshtml

4.OpenAppointment.cshtml <Not calling this method when doublick click first time in scheduler)

setValues = function (obj) {
    var inputs = document.body.getElementsByTagName('input');
    alert(inputs);
    debugger;
  
};

Please let us know if need any more information.

Thanks

Hi small change:
instead of SetExternalLight i changed to SetExternalLightForm
//view, width, height
var box = sched.Lightbox.SetExternalLightboxForm("Appointment/Lightboxform ", 420, 195); – This is different controller.

but no luck…

Hi,
make sure ‘setValues’ and ‘getValues’ methods are available in ‘Appointment/Lightboxform’ view.
When the lightbox is defined via ‘SetExternalLightForm’ method, the component loads the view into an iframe. When the frame is loaded component tries to call ‘setValues’ method of a iframe window.
If these methods are defined in the main page - they won’t be found in the lightbox iframe

Hi,

Thanks for your reply. I modified the code according to your changes.

It’s not working first time even i place the code in main view (LightBox.cshtml)
but i put the alert(‘test’) message it’s working first time. I am so confused is it because slow the set method property to retrieve.

If i place the alert(‘test’) when i debug “var inputs = document.body.getElementsByTagName(‘input’);” - it’s working perfectly.

If i don’t place alert(‘test’) when i debug “document.body.getElementsByTagName(‘input’)” length is ‘0’ - not working because no alert message.

why it’s working when i place alert message…? i am confused.

setValues = function (obj) { alert('test'); // it's working if i place the alert message. var inputs = document.body.getElementsByTagName('input'); }; Thanks.

Hi,
can you attach a complete project, so I could run it locally?

Hi,

I cant attach all my project because it’s very big the size. i have attached required files for testing purpose.

You can add those files in your mvc 4 project.

“setValues” you can find that code in Lightboxform.cshtml. it’t the parent for lightbox.

let me know if anything.Thanks
Samplefiles.zip (26.4 KB)

Hi,
I couldn’t reproduce the problem.
After i was able to run the app (had to replace external files by a static data, and install one package from NuGet), lightbox is shown without the buttons and i can’t invoke saving from the UI.
screencast.com/t/ZKmoDTm1i

Please send a demo that can be used for reproducing the issue(or modify the attached one), otherwise I can’t reproduce the issue.
Test demo:
s3.amazonaws.com/uploads.hipcha … ghtbox.zip

One thing regarding markup. however, it’s unlikely caused any side effects[code]

[/code]

You probably don’t need to add dhtmlxtabbar.css, dhtmlxcommon.js, dhtmlxtabbar.js, as they are included into dhtmlx.js/dhtmlx.css

Hi,

Sorry for that. I uploaded another sample project files. you can copy to your MVC4 project and you can try. let me know if anything.

Thanks
TEST_Project_files_MVC4.rar (15.2 KB)