Attaching an event to infoBox

I’m trying to attach an event to the infoBox so that when it is open, I can add more content.

I looked into InfoBoxViewModel showInfo but I couldn’t find how I would access this Knockout variable. Additionally, I was thinking about:

handler.setInputAction(function(e){
// add jQuery code to add event in a setTimeout
},Cesium.ScreenSpaceEventType.LEFT_CLICK);

``

Any ideas?

I’m probably thinking about this very backwards.

This does what I want but it’s pretty sketchy…

$(".cesium-viewer-infoBoxContainer").on(‘mouseover’, function(e){

$("#editar").on(‘click’, function(e){

e.preventDefault();

that = $(this);

href = that.attr(‘href’);

dialogCedulaPopUp(href); // open dialogue

});

});

``

Still learning Knockout which would be better in this scenario most definitely.

To subscribe to the observable showInfo boolean property:

Cesium.knockout.getObservable(viewer.infoBox.viewModel, ‘showInfo’).subscribe(function(newValue) {

});

The function will be called whenever showInfo changes, and newValue will be true or false.

Thanks a lot, Scott!

I’m just getting around to learning subscriptions in Knockout.

While you’re learning Knockout, keep in mind that Cesium also uses the knockout-es5 plugin to expose observable data as properties for ease of use. The call to getObservable is part of the es5 plugin, not regular Knockout.

http://blog.stevensanderson.com/2013/05/20/knockout-es5-a-plugin-to-simplify-your-syntax/

Thanks for the explanation and link!