OpenSource For You

Metacontro­ls

-

The magic of draft forms is given to you for programmat­ic use, piece by piece. The forms are built using jetaContro­ls, which too are automatica­lly generated, one for each table. Every jetaContro­l contains methods to create input controls for each column in the table. So, for example, if you want to create a page that contains the textJbox for entering a blog post title from your example database, all you would need to do isW // Create a textbox on the page Athis->txtTitle = new nText_oxEAthisFX //Create jetaContro­l for new most Amctmost = mostjetaCo­ntrolWWCre­ateEAthisI nullI njetaContr­olCreat eTypeWWCre­atelnoecor­dkotcoundF­X // det input control from jetaContro­lDs creator function Athis->txtTitle = Amctmost->txtTitle_CreateEFX

And the textbox ‘txtTitle’ would contain all the limitation­s for the title column of post table in place; just render it! Now how can you get it done easier?

If the above code does not make any sense, you can either have a look at it in the second part of the nCubed examples site, or wait for the next article in the series, when we cover how nCubed helps you build Web pages real fast.

jetaContro­ls are created depending on the dataJtype of each column. For example, if the data type is varchar, then the control would be a textbox; if it is text, the control would be a textarea element; if it is Boolean, the control would be a checkbox; and if it is a foreign key, it will be a dropJdown select element. The jetaContro­ls also contain informatio­n needed for validation, so that a form submission does not result in an error from the database. They are available for programmat­ic use, and you are probably never going to write validation logic for database columns again.

In addition to the goodies mentioned above, nCubed also generates an AJAX control panel, which brings all the forms to one place, and can easily serve as the central control panel for all data you use in your Web app. from multiple tables. vou can select which columns you want to be sortable andLor searchable as well. However, there are a couple of drawbacks with nDatadrids­W vou cannot use the search or sort feature across columns that belong to two different tables. But you can display data from two tables in one nDatadrid using the templating feature they possess. vou cannot create a nDatadrid using a handJwritt­en query—you must use nCubed’s builtJin database querying mechanism called nnuery. This is because nDatadrids cannot work on raw result sets in array format. They work only with objects.

 ??  ?? Figure 2: QDataGrids: Easy-to-use tables with search options
Figure 2: QDataGrids: Easy-to-use tables with search options

Newspapers in English

Newspapers from India