Results 1 to 6 of 6

Thread: How to add Variable in Title:???

  1. #1

    Question How to add Variable in Title:???

    Hi:
    I am totally a newbie to this but I wanted to know how to add a variable attribute to the title section for example I would like the header/title to say .. I am using Data Grid...
    Detail Report for: [then the variable name]
    Here is my code:
    // CREATE THE GRID
    var grid = new Ext.grid.GridPanel({store: store, columns: [
    {id: 'Student', header: "Student", width: 50, sortable: true, dataIndex: 'Student'}
    ],
    stripeRows:true,
    autoExpandColumn: 'Student',
    height: 500, width: 1000,
    stateful: true,
    stateId: 'grid',
    title: 'Detail Report For:'});

    Thanks

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    String concatenation?

  3. #3

    Question I did try??

    I did try that but did not work...
    Maybe I have the wrong syntax:
    // CREATE THE GRID
    var grid = new Ext.grid.GridPanel({store: store, columns: [
    {id: 'Student', header: "Student", width: 50, sortable: true, dataIndex: 'Student'}
    ],
    stripeRows:true,
    autoExpandColumn: 'Student',
    height: 500, width: 1000,
    stateful: true,
    stateId: 'grid',
    title: 'Detail Report For:' + Student}); <== I believe this is wrong...

  4. #4
    Ext User
    Join Date
    Mar 2009
    Location
    Sinaloa, Mxico
    Posts
    102

    Default

    If you want it directly with Php you need this way:

    Code:
    title: 'Detail Report For: <? echo $your_var; ?>'});
    If the grid is filled with an event then:

    Code:
    grid.setTitle('Your new title here');

  5. #5

    Question Let me rephrase

    I am basically doing this in salesforce.com environment. I have the grid up but instead of showing the same student name over and over again I figure I place the student name up in the title section.
    stripeRows:true,
    autoExpandColumn: 'Student', <== here is the Student Name
    height: 500, width: 1000,
    stateful: true,
    stateId: 'grid',
    title: 'Detail Report For: ' + store});

    This gave me Detail Report For: [object Object]

    which I have no idea what that refers to...
    As for the grid I call it through div tags
    <div id="displayhere"></div>

  6. #6
    Ext User
    Join Date
    Dec 2007
    Posts
    95

    Default

    title: 'Detail Report For: ' + store});

    "store" is (presumably) an Ext.data.Store object, not a string. You need to determine how to get the student's name as a string (you might have to read the documentation for Store) and concatenate that to the title of the grid.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •