Question
· Oct 26, 2016

Usins inputtype : select in MOJO

Hi All

When using a select :

  {type:'$input',id:'Table-Alert-Alert', key:'Table-Alert-Alert', inputType:'select', children: [
              { type: '$loop', value: '=[AlertTList]',children: [
              {type:'$option', value:'=[id]', selected: '=[selected]', $content: '=[AlertText]'}
              ]}
         ]},

I can get only value & text of the selected object :

      $("#Table-Alert-ID").val($("#Table-Alert-Alert option:selected").val())
      $("#Table-Alert-Text").val($("#Table-Alert-Alert option:selected").text())
There are some more properties in the AlertTList I would like to present on the page , without going back to the server.

Can I do it & in case I can how

Thanks Simcha

in csp I can do :

 

<csp:SQLQUERY NAME='query' P1='A'>

SELECT ID,Name,Age FROM IscPerson WHERE Name %STARTSWITH ? Order By Name

</csp:SQLQUERY>

<ul>

<csp:WHILE CONDITION="query.Next()">

    <li>#(query.Get("Name"))# &nbsp #(query.Get("Age"))#

</csp:WHILE>

</ul>

 

 

 

 

Got an answer from WRC

 

{type:'$input', id:'demoSelect', key:'demoSelect', inputType:'select', multiple:true, children: [
             { type: '$loop', value: '=[orgs]',
              children: [{type:'$option', value:'=[id]', selected: '=[selected]',
              $content: '=[caption]', dataName:'=[name]', dataLastName: '=[lastName]'}
              ]}
         ]}

can add extra parameters to option, provided they start with 'data':

 

then to call them use :

$("#demoSelect option:selected")[0].getAttribute('dataName'));

 

It works

Thanks all

Discussion (2)0
Log in or sign up to continue

Hi Simcha,

you can easily retrieve the data that you are using in your layout (AlerTList in your case), by calling the function getSourceData() on your documentView component. Assuming the id of your documentView is 'mainView', the following code sample should work in your environment:

var view = zen('mainView');

var data = view.getSourceData();

console.log(data.AlerTList);

HTH,

Stefan