use skuid.model.getModel in a page include in a popup

hi,

I have this piece of code to show some messages:

var osi = skuid.model.getModel('osi'); var row = osi.data[0]; [...] some calculations.... [...] if(txtwarnings!==""){ skuid.$('#txtwarning').html(txtwarnings).addClass('paddings').addClass('warning'); }else{ skuid.$('#txtwarning').html(''); } if(txtOk!==""){ skuid.$('#txtOk').html(txtOk).addClass('paddings').addClass('ok'); }else{ skuid.$('#txtOk').html(''); }

it’s working fine:

But If I include (page include component) this page in a popup in other page this does not work.

Javascript shows this error message:

Uncaught TypeError: Cannot read property ‘data’ of undefined (in line 3)

Line 3 is: var row = osi.data[0];

so var osi = skuid.model.getModel(‘osi’); is returning undefined.

‘osi’ is the model id in the included page and in the parent page that id doesn’t exists.

how can I make this work?

See these posts:

https://community.skuidify.com/skuid/topics/how_do_i_wait_for_the_dom_to_load_within_a_skuid_page_in…

https://community.skuidify.com/skuid/topics/queue_page_include_console_error_cannot_read_property_re…

Thanks!! it’s working!