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


    Default dynamic extjs (like php)

    dynamic extjs (like php)

        <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>
    //ommitted codes here
    //ommitted codes here
    grid = new Ext.grid.EditorGridPanel({
                renderTo: document.body,
                title: 'Movie Database',
                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
    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
    Frederick MD, NYC, DC
    Vote Rating
    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



    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..."