|
Title: Tutorial 4 - Display Data In Real Database Post by: steven on January 22, 2009, 12:51:39 AM With experience of Tutorial 2 & Tutorial 3, you may have some rough idea of how to display data in real database. You don't know? Let me give you some sparkles.
If we change hello.html content from to Can you get it? Here we go. [Req Spec] 1. A treegrid and a button are needed. 2. When end user click button, treegrid shows rows in database. [Do It Yourself] 1. Firstly, prepare a file named hello.php to http://localhost/hello.php. It reads 2. Drag a [treeGrid] to design area,set its alias to "treegrid1"(Click dialog window to select it, type "treegrid1" in [Component Config Window]->[alias],and strike [Enter] on keyboard. ) 3. Drag a [Button] to design area. 4. Add event handler for button being clicking. (Click [input] to select it,click on right side of [Component Config Window]->[events]->[onClick],a small button will appear. Click this button, a dialog box will pop up.) 5. You will see the following lines in the dialog 6. In the handler, we will call linb.request. 7. Do you remember function treegrid1.setRows? A very important thing I have to say is rep above is string in type. So we need to convert it to 2d array object. Function _.unserialize is introducted here (also see http://www.sigmawidgets.com/products/sigma_visual/API/index.html#_.unserialize). This function can help you convert string to Javascript object. It takes two parameters. We could ignore the second parameter because we have no date variables to deal with. Think of the following code. The lines will popup an alter box say 25. 8. After you understand unserialize, We could complete code look like 9. Click [OK] to close dialog. 10. Press [run] to see the result. The above sample show us a way to communicate with server side. The left thing is just change hello.php and retrieve real data from database. Simply create a database named testdb and execute the following sql. And change hello.php to the following code. If you don't understand it, you need more knowledge on php instead of Sigma Visual builder. Title: Re: Tutorial 4 - Display Data In Real Database Post by: arobaseplus on March 04, 2009, 06:31:53 AM Thanks for the nice tutorial.
How can we kow about various controls propeties? such as, accessing/setting the properties and methods? is there any manual descrbing all thecontrols with examples? please help me. Title: Re: Tutorial 4 - Display Data In Real Database Post by: steven on March 04, 2009, 05:23:22 PM Sigma Visual components are designed very simply. Just keep in mind
1. control have many properties 2. there are two methods for one property, setter and getter. Take "caption" of "Panel" for example, there must be two methods setCaption and getCaption. 3. You can get directly to definition by double clicking on the property in the "Config Window" 4. You can get API definition as well as samples at http://www.sigmawidgets.com/products/sigma_visual/API/. Title: Re: Tutorial 4 - Display Data In Real Database Post by: steven on March 04, 2009, 05:26:37 PM You are kindly suggested to watch the training video first
Title: Re: Tutorial 4 - Display Data In Real Database Post by: j2ibeo on November 28, 2009, 05:27:13 AM Hi,
I found this tool very interesting and kudos to the maker of this tool! ;) My question is after testing this Tutorial #4, data is displayed in the grid alright but when I checked out the Tools->Error Console (in Firefox) I see that there is a syntax error like this: Error: syntax error Source File: http://localhost/users.php Line: 1, Column: 1 Source Code: [[\'sub11\',\'sub12\',\'sub13\'],[\'sub21\',\'sub22\',\'sub23\']] and an arrow pointing to the 2nd '[' any clue how to remove this? thanks |