Sigma Php Ajax framework, Ajax Components, GUI Builder
July 30, 2010, 09:21:14 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Tutorial 4 - Display Data In Real Database  (Read 5142 times)
steven
Moderator
Hero Member
*****
Posts: 539



View Profile
« 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. 
« Last Edit: March 13, 2009, 12:51:30 AM by steven » Logged

Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
arobaseplus
Newbie
*
Posts: 2


View Profile
« Reply #1 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.
Logged
steven
Moderator
Hero Member
*****
Posts: 539



View Profile
« Reply #2 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/.
Logged

Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
steven
Moderator
Hero Member
*****
Posts: 539



View Profile
« Reply #3 on: March 04, 2009, 05:26:37 PM »

You are kindly suggested to watch the training video first
Logged

Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
j2ibeo
Newbie
*
Posts: 1


View Profile
« Reply #4 on: November 28, 2009, 05:27:13 AM »

Hi,
I found this tool very interesting and kudos to the maker of this tool!  Wink

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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!