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

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
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?
Photo of Pablo Martinez

Pablo Martinez

  • 2,468 Points 2k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Photo of Pablo Martinez

Pablo Martinez

  • 2,468 Points 2k badge 2x thumb
Thanks!! it's working!