1. #1
    Ext User
    Join Date
    Mar 2009
    Posts
    5
    Vote Rating
    0
    len is on a distinguished road

      0  

    Default dynamic extjs (like php)

    dynamic extjs (like php)


    Code:
    <html>
    <head>
        <title>Editor Grids</title>
        <link rel="stylesheet" type="text/css" href="../../../lib/extjs/resources/css/ext-all.css" />
         <script type="text/javascript" src="../../../lib/extjs/adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="../../../lib/extjs/ext-all.js"></script>
        <script>
    //ommitted codes here
    .
    .
    .
    //ommitted codes here
    grid = new Ext.grid.EditorGridPanel({
                renderTo: document.body,
                frame:true,
                title: 'Movie Database',
                height:300,
                width:520,
                enableColumnMove: false,
                store: store,
                clicksToEdit: 2,
                columns: [
                    {header: 'Movie Title', dataIndex: 'title', editor: title_edit},
                    {header: 'Director', dataIndex: 'director', editor: director_edit},
                    {header: 'Released', dataIndex: 'released', renderer: Ext.util.Format.dateRenderer('Y-m-d'), editor: release_edit},
                    {header: 'Genre', dataIndex: 'genre', renderer: genre_name, editor: genre_edit},
                    {header: 'Tagline', dataIndex: 'tagline', editor: tagline_edit}
                ],
    //ommitted codes here
    .
    .
    .
    //ommitted codes here
        </script>
    </head>
    <body>
    </body>
    </html>
    hello guys,

    i have a php file (containing the code above).
    in the code, i have a grid basically, as can be seen above, i hard coded the parts of the columns config object (header, dataIndex, etc...).
    i have a table in the database containing 5 columns (the ones being displayed in the grid) so everything seems to be fine (as the store queries the table).

    my problem is if i modify the number of columns in the table, i have to modify again (hard-coding again) the above file since it's javascript(?)

    in php i could have done this dynamically i mean i could have used the for each () statement (instead of hard coding every column) to display every column queried from the table.

    is there a way in extjs to do the same thing, not requiring rehard-coding the code every time a change is made in the structure of the backend tables (or by the result set being returned by the query)? or is this a limitation we have to live with using extjs?

    please enlighten me

    thanks a lot guys

  2. #2

  3. #3
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    80
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    There is no reason why you can't have PHP that generates JavaScript dynamically. Hell, it's been done for many years now.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."