7.2.2. dataController

Last page update: November 23, 2011

type: client-side controller

The dataController belongs to client-side controllers family.

7.2.2.1. Definition

GnrDomSrc_dojo_11.dataController(script=None, **kwargs)

Create a dataController and returns it. dataController allows to execute Javascript code

Parameters:
  • script – the Javascript code that datacontroller has to execute.
  • **kwargs_init, _onStart, _timing. For more information, check the controllers’ common attributes section

commons attributes:

For commons attributes (_init, _onStart, _timing) see controllers’ common attributes

7.2.2.2. Examples

We show you two different syntaxes for the dataController:

class GnrCustomWebPage(object):
    def main(self,root,**kwargs):
        bc = pane.borderContainer(height='200px')
        fb = bc.formbuilder(cols=2,datapath='test1')

        # First syntax
        fb.dataController("SET .aaa='positive number'" ,_if='shooter>=0',
                            _else="SET .aaa='negative number'",shooter='^.x')
        fb.numberTextbox(value='^.x',lbl='x')
        fb.textbox(value='^.aaa',margin='10px',lbl='aaa')

        # Second syntax
        fb.dataController("""if(shooter>=0){SET .bbb='positive number';}
                               else{SET .bbb='negative number';}""",
                               shooter='^.y')
        fb.numberTextbox(value='^.y',lbl='y')
        fb.textbox(value='^.bbb',margin='10px',lbl='bbb')

Table Of Contents

Previous topic

7.2.1. data

Next topic

7.2.3. dataFormula

This Page