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.skuid.com/t/how-do-i-wait-for-the-dom-to-load-within-a-skuid-page-in…

https://community.skuid.com/t/queue-page-include-console-error-cannot-read-property-re…

Thanks!! it’s working!