Results 1 to 5 of 5

Thread: cannot get value from columnmodel to pass parameter to a link

  1. #1

    Question cannot get value from columnmodel to pass parameter to a link

    Hello everyone,

    I'm newbie of extjs - my problem is how can I get value data (club_id) from datastore or columnmodel when I click on <a href> link for pass parameter to php file.
    My Code is
    ========

    resultDataStore = new Ext.data.Store({
    id: 'resultDataStore',
    proxy: new Ext.data.HttpProxy({
    url: 'clubstatus.php',
    method: 'POST'
    }),
    baseParams:{
    task: ""
    },
    reader: new Ext.data.JsonReader({
    root: 'results',
    totalProperty: 'total',
    id: 'club_guid'
    },[
    {name: 'club_guid', type: 'int', mapping: 'club_guid'},
    ...
    ...
    {name: 'sum_operator', type: 'int', mapping: 'sum_operator'},
    ]),
    sortInfo:{field: 'club_guid', direction: "ASC"}
    });
    resultColumnModel = new Ext.grid.ColumnModel(
    [
    {
    header: '<b>Club ID</b>',
    id: 'p_club_guid',
    readOnly: true,
    dataIndex: 'club_guid',
    width: 70,
    sortable: true,
    hidden: false,
    readOnly: true
    },

    ...
    ...
    ,
    {
    header: '<b>Total</b>',
    readOnly: true,
    dataIndex: 'sum_operator',
    align: 'right',
    width: 100,
    sortable: true,
    hidden: false,
    readOnly: true,
    renderer: function(value) {
    return "<a href="test.php?club_guid=xxxx">"+value+"</a>" }
    }


    resultColumnModel.defaultSortable= true;
    resultDataStore.load();
    resultListingEditorGrid = new Ext.grid.EditorGridPanel({
    id: 'resultListingEditorGrid',
    store: resultDataStore,
    cm: resultColumnModel,
    enableColLock:false,
    clicksToEdit:1,
    selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),
    autoHeight: true,
    align: 'center'
    //height: 500,
    });


    resultListingEditorGrid.render('div_result');

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    A renderer has more parameter (see the API docs for Ext.data.ColumnModel.setRenderer).

  3. #3

    Default

    Can you give me some example ? I'm really newbie

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Example:
    Code:
    renderer: function(value, meta, record) {
      return "<a href="test.php?club_guid=' + record.get('club_guid') + '">" + value + "</a>";
    }
    ps. I a true single-page Web 2.0 application you wouldn't be using anchors. Instead you render the value as blue/underlined (so it looks like a link) and register a cellclick event handler on the grid.

  5. #5

    Default

    Many thanks for your kindly , Condor
    I can continue coding huh huh .. ^^

Similar Threads

  1. Pass a textfield as a parameter to a DataStore
    By caponet in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 27 Apr 2009, 6:17 AM
  2. How to pass parameter from php to js ??
    By nuinisk in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 17 Apr 2009, 3:33 PM
  3. how can I pass parameter to Ext.window
    By groth in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 26 Nov 2008, 7:33 AM
  4. [Solved] Store Parameter pass
    By michaelc in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 17 Apr 2008, 1:53 PM
  5. How can Pass More Than one parameter from combobox
    By golla.sudheerkumar in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 11 Apr 2008, 6:40 AM

Posting Permissions

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