tailieunhanh - Web to py enterprise web framework - p 28

REMOTE PROCEDURE CALLS 255 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 simple todo application simple todo application type a new task to insert in db, click on existing task to delete it This view just executes the Pyjamas code in "static/output/todoapp". Code that we have not yet created. Fifth, in "static/" (notice it is TodoApp, not todoApp!), enter the following client code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18. | REMOTE PROCEDURE CALLS 255 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 meta name pygwt module content URL r request c static f output todoapp title simple todo application title head body bgcolor white h1 simple todo application h1 i type a new task to insert in db click on existing task to delete it i script language javascript src URL r request c static f output script body html This view just executes the Pyjamas code in static output todoapp . Code that we have not yet created. Fifth in static notice it is TodoApp not todoApp enter the following client code from pyj import RootPanel from import Label from import VerticalPanel from pyj import TextBox import pyj from pyj import ListBox from import HTML from pyj import JSONProxy class TodoApp def onModuleLoad self DataService panel VerticalPanel TextBox self ListBox 7 200px self Label Label Add New Todo Label Click to Remove self RootPanel .add panel 256 SERVICES 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 1 2 def onKeyUp self sender keyCode modifiers pass def onKeyDown self sender keyCode modifiers pass def onKeyPress self sender keyCode modifiers This function handles the onKeyPress event and will add the item in the text box to the list when the user presses the enter key. In the future this method will also handle the auto complete feature. if keyCode .

TỪ KHÓA LIÊN QUAN