2013-04-30 09:49:34 +04:00
|
|
|
from orun.extjs import *
|
|
|
|
from orun.extjs import cp
|
|
|
|
|
2018-08-07 22:31:53 +03:00
|
|
|
def ok_click(id_, *args, **kwargs):
|
|
|
|
js.cli << Ext.getCmp(id_).setText('Clicked')
|
|
|
|
js.cli << js.client.alert('Server side message')
|
2013-04-30 09:49:34 +04:00
|
|
|
|
2018-08-07 22:31:53 +03:00
|
|
|
def button_click(id_, *args, **kwargs):
|
2013-04-30 09:49:34 +04:00
|
|
|
js.write("""
|
|
|
|
Ext.getCmp("%s").setText('Clicked');
|
|
|
|
alert('Server side callback message');
|
2018-08-07 22:31:53 +03:00
|
|
|
""" % id_)
|
2013-04-30 09:49:34 +04:00
|
|
|
|
|
|
|
class MyApplication(cp.ExtApplication):
|
|
|
|
def main(self, *args, **kwargs):
|
|
|
|
wnd = Ext.create('widget.window', {'title': 'My Window', 'width': 300, 'height': 250,
|
|
|
|
'items': [{'xtype': 'button', 'text': 'Click Here', 'handler': button_click}],
|
|
|
|
'buttons': [
|
|
|
|
{'text': 'OK', 'handler': ok_click},
|
2018-08-07 22:31:53 +03:00
|
|
|
{'text': 'Close', 'handler': js.function('this.up(\'window\').close()')}]})
|
2013-04-30 09:49:34 +04:00
|
|
|
wnd.show()
|
|
|
|
wnd.setHeight(200)
|
|
|
|
|
|
|
|
app = MyApplication('Orun (ExtJS Application)')
|
|
|
|
app.run()
|