Results 1 to 3 of 3

Thread: [Ext2.0-RC1] Follow-up: access GridPanel cell data after dblclick

  1. #1
    Sencha User
    Join Date
    Oct 2007
    Posts
    33

    Default [Ext2.0-RC1] Follow-up: access GridPanel cell data after dblclick

    Hi all,

    ..first of all - thanks a lot all of you for all the help and input, without the various q's and a's everywhere I would probably still be stuck in the very first steps, as I am not really deep into anything I am doing here

    However - I am fighting in accessing a cell in a GridPanel after doubleclick. And yes, I have been searching through API and Forum for while - but didn't really find anything which worked. Last example I saw was the proposal in:
    http://extjs.com/forum/showthread.ph...SelectionModel

    So I used that code and modified very little, but I am just not getting it to work:

    Code:
    	newTab.on('celldblclick', function(oGrid, rowIndex, colIndex) { 
            var record = oGrid.getStore().getAt(rowIndex);  // Get the Record
            var fieldName = oGrid.getColumnModel().getDataIndex(colIndex); // Get field name
            var data = record.get(fieldName);
    	debugger;
    	});
    The problem starts at "fieldName" - it is "undefined". Could that really be at this place ? When I check in Firebug, the "record" collection is filled correctly with the data and the data has correct field names. However, "fields" collection in "record" is all undefined. But "items" collection in "record" has the correct data AND has the correct fields. So am I missing something very obvious ?

    Does it make a difference that I am using "CellSelectionModel" ?

    Code:
        var newTab = new Ext.grid.GridPanel({
        	title: cTit,
        	id: cTabID,
        	closable:true,
        	stripeRows: true,
        	trackMouseOver: false,
            ds: ds,
            cm: colModel ,
            sm: new Ext.grid.CellSelectionModel({singleSelect:true}),
    Below see the ColModel:
    Code:
       var colModel = new Ext.grid.ColumnModel([
            {id:'Time',header: "Time", width: 60, sortable: false, locked:false},
            {id:'Day1',header: "Mo, " + dDays[1], sortable: false, locked:false},
            {id:'Day2',header: "Tu, " + dDays[2], sortable: false, locked:false},
            {id:'Day3',header: "We, " + dDays[3], sortable: false, locked:false},
            {id:'Day4',header: "Th, " + dDays[4], sortable: false, locked:false},
            {id:'Day5',header: "Fr, " + dDays[5], sortable: false, locked:false},
            {id:'Day6',header: "Sa, " + dDays[6], sortable: false, locked:false},
            {id:'Day7',header: "Su, " + dDays[7], sortable: false, locked:false}
        ]);
    Any input would be very much appreciated,
    thanks a lot,
    Frank

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854

    Default

    Break that line in pieces. Is the columnModel being returned? Is the colIndex arg correct? Also, getDataIndex returns a number, not the fieldname.

  3. #3
    Sencha User
    Join Date
    Oct 2007
    Posts
    33

    Default

    Hi Tim,
    thanks a lot for your reply! And sorry, my mistake - yes, of course, getDataIndex does not return the field name. However, someone might want to update the API Doc, as I copied below code from it:

    Code:
    newTab.on('celldblclick', function(oGrid, rowIndex, colIndex) { 
            var record = oGrid.getStore().getAt(rowIndex);  // Get the Record
            var fieldName = oGrid.getColumnModel().getDataIndex(colIndex); // Get field name
            var data = record.get(fieldName);
    ..is straight from API Doc at http://extjs.com/deploy/dev/docs/?cl...mber=cellclick.

    Coming to your questions - yes, columnModel is displayed correct and works fine and colIndex arg is correct as well....
    Thanks again for your support,
    Frank

Posting Permissions

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