Author Topic: How to enable text selection ?  (Read 5699 times)

mr_unicoder

  • Newbie
  • *
  • Posts: 2
    • View Profile
How to enable text selection ?
« on: May 11, 2014, 10:52:11 pm »
Hello there,
I've started to use PQGrid and I've to say it's a wonderful grid
but I've one issue, i can't select/highlight cell contents while editing is disabled
Is there any way to enable it ?

I've tried the solution in this reply but it didn't work
« Last Edit: May 11, 2014, 10:54:26 pm by mr_unicoder »

mr_unicoder

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: How to enable text selection ?
« Reply #1 on: May 11, 2014, 11:18:50 pm »
I've solved it using:
$('.pq-cont').enableSelection()

but selection got lost on scroll
« Last Edit: May 11, 2014, 11:21:14 pm by mr_unicoder »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: How to enable text selection ?
« Reply #2 on: May 12, 2014, 01:24:22 pm »
Add this code in the refresh event.

[email protected]

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: How to enable text selection ?
« Reply #3 on: December 07, 2014, 07:26:09 pm »
The above solution is not working form me. Am I doing anything wrong?

var grid1=$("#grid_md").pqGrid({
      width: 'auto',
      height: 550,
      colModel: pqcolmodel,
      dataModel: pqdatamodel,
      showTop: false,
      editable: false,
      resizable: false,
      columnBorders: true,
      minWidth: 10,
      pageModel: { type: "local", rPP: 100, rPPOptions:[10, 100, 200, 500] },
      //freezeCols: 0,
      roundCorners: false,
      numberCell: false,
      //scrollModel: {horizontal : false},
      bottomVisible: true,
      stripeRows: true,
      hoverMode: 'row',
      selectionModel: { type: 'row', mode: 'range'}
    });
    $("#grid_md").enableSelection();

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
    • View Profile
Re: How to enable text selection ?
« Reply #4 on: December 08, 2014, 05:38:33 pm »
jkoci

PQ pro has its own mechanism to select rows/cells and copy / paste cells, rows. This post is related to native selection of text.

If you want the same then you have to disable the inbuilt selection model and swipeModel of the grid and call enableSelection in refresh event.

Example:
http://jsfiddle.net/8qpmxrye/