Last page update: November 23, 2011
- GnrDomSrc_dojo_11.remote(method, lazy=True, **kwargs)¶
Build a remote and return it
Parameters:
- method – the name of the remote method (without the remote_ prefix)
- lazy – boolean. TODO
The remote method allow to build remotely any element of a webpage, like a a ContentPane, a TabContainer, a form, and so on.
remote call:
remote(method='STRING', [**kwargs])where:
- STRING is the name of the remote method declaration, without its remote_ prefix
remote method declaration:
def remote_STRING(self, [**kwargs]):where:
- STRING is the name you gave to the method attribute in the remote call
Introduction: an example with the basic usage of the remote method
- In line 16 we call the remote; tabs is the name of the method
- In line 18 we define the remote method, as remote_tabs, that is remote_ plus the tabs defined in line 16
- Lines 19, 20 and 21 build some tabContainers remotely (that is, on server)
Note
example elements’ list:
- classes: GnrCustomWebPage
- components: TestHandlerFull
- controllers: remote
- webpage variables: py_requires
- widgets: BorderContainer, ContentPane, data, NumberSpinner
Code:
1 # -*- coding: UTF-8 -*- 2 """remote""" 3 4 class GnrCustomWebPage(object): 5 py_requires = "gnrcomponents/testhandler:TestHandlerFull" 6 7 def test_1_remote(self, pane): 8 """Basic remote""" 9 bc = pane.borderContainer(height='300px') 10 fb = bc.contentPane(region='top', height='30px').formbuilder(cols=2) 11 fb.numberspinner(value='^.numtabs', lbl='Number of tabs', min=0, max=20) 12 bc.data('.numtabs', 0) 13 fb.div('Move focus out of the NumberSpinner to update tabs (max tab numbers set to 20)', 14 font_size='.9em', text_align='justify', margin='10px') 15 tc = bc.tabContainer(region='center') 16 tc.remote('tabs', numtabs='^.numtabs') 17 18 def remote_tabs(self, tc, numtabs): 19 for i in range(numtabs): 20 tab = tc.contentPane(title='Tab %d' % i, position='absolute', margin='60px') 21 tab.div('This is tab n.%d' % i)