1. #1
    Ext User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
    leobass is on a distinguished road

      0  

    Default Copy and paste in grid columns and rows

    Copy and paste in grid columns and rows


    Hi guys,

    I'm very new with EXT JS Grid and I'm working with a grid that has chechkbox and text data, the problem is that the user cant select rows or columns to copy the data. Is there a way this could be done?

    This is the way Im creating some of the columns:

    'detail' => array (
    '#sortable' => self::COL_SORTABLE_ITEM_NUMBER,
    '#hideable' => self::COL_HIDEABLE_ITEM_NUMBER,
    '#width' => self::COL_WIDTH_PRIMARY_ZIP,
    ),
    'item_number' => array (
    '#sortable' => self::COL_SORTABLE_ITEM_NUMBER,
    '#hideable' => self::COL_HIDEABLE_ITEM_NUMBER,
    '#width' => self::COL_WIDTH_ITEM_NUMBER,
    ),
    'item_head' => array (
    '#sortable' => self::COL_SORTABLE_ITEM_NUMBER,
    '#hideable' => self::COL_HIDEABLE_ITEM_NUMBER,
    '#width' => self::COL_WIDTH_ITEM_HEAD,

    ),


    Is there a property to change to allow this option?


    Regards
    Esteban

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,169
    Vote Rating
    28
    jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough

      0  

    Default


    Dude, what framework are you using? That's PHP, not JavaScript

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.

  3. #3
    Ext User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
    leobass is on a distinguished road

      0  

    Default


    That's Drupal :P ... sorry I paste the wrong code

    This is the JS code:

    Ext.onReady(function(){
    var xg = Ext.grid;
    var reader = new Ext.data.ArrayReader({},
    $js_fields);

    var txtIds = ',' + '
    $disabled_checkbox' + ',';

    var sm = new xg.CheckboxSelectionModel({checkOnly: true,
    renderer: function(value, metaData, record) {
    // Hide checkbox for certain records
    var indexId = record.get('index_id');
    if (txtIds.indexOf(',' + indexId + ',') > -1) {
    return '';
    }
    //return '<div class="x-grid3-row-checker"> </div>';
    return Ext.grid.CheckboxSelectionModel.prototype.renderer.apply(this, arguments);
    }
    });
    var grid2 = new xg.GridPanel({
    store: new Ext.data.Store({
    reader: reader,
    data: xg.dummyData
    }),
    cm: new xg.ColumnModel({
    defaults: {
    width: 120,
    sortable: true
    },
    columns:
    $js_columns

    }),
    sm: sm,
    columnLines: true,
    width:
    $table_width,
    height:
    $table_height,
    frame: false,
    singleSelect: true,
    renderTo: 'editor-grid'

    });

  4. #4
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,169
    Vote Rating
    28
    jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough

      0  

    Default


    Please use CODE tags in the future!

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.

  5. #5
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,169
    Vote Rating
    28
    jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough

      0  

    Default


    Do you want them to be able to select Text from the grid?

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.

  6. #6
    Ext User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
    leobass is on a distinguished road

      0  

    Default


    Yes, the idea is that the users can copy and paste the data that is in every cell.

  7. #7
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,169
    Vote Rating
    28
    jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough

      0  

    Default


    so you want to be able to copy "rows" of data?


    I'm confused as to what the requirements are. Where are they copying to?
    Either way, what you're looking for is not out of the box. You'll need to work at it.

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.

  8. #8
    Ext User
    Join Date
    Jul 2009
    Posts
    7
    Vote Rating
    0
    leobass is on a distinguished road

      0  

    Default


    I need to copy columns or rows of data just like you copy and paste from an excel doc to a text pad.

  9. #9
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,169
    Vote Rating
    28
    jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough

      0  

    Default


    It's not that simple! You can't post to the clipboard with JavaScript.

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.

  10. #10
    Sencha User
    Join Date
    Aug 2009
    Posts
    75
    Vote Rating
    0
    madirishman is on a distinguished road

      0  

    Default


    Yeah, although the grid looks like a spreadsheet - it's actually just a bunch of css and javascript wrapped around your data. Your cursor has no idea how to select the rows + columns. You will have to look into some kind of "export" method to export the data as a spreadsheet, or .csv.

    md