Author Topic: is it possible to make a particular cell not editable?  (Read 4572 times)

kavyasetty

  • Newbie
  • *
  • Posts: 25
    • View Profile
is it possible to make a particular cell not editable?
« on: December 13, 2013, 11:33:01 am »
Hi ,

is it possible to make a particular cell not editable?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: is it possible to make a particular cell not editable?
« Reply #1 on: December 13, 2013, 09:23:00 pm »
return false in cellClick event.

This might be helpful http://jsfiddle.net/LAgZx/71/
« Last Edit: December 21, 2013, 10:49:47 am by paramquery »

Leo F

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: is it possible to make a particular cell not editable?
« Reply #2 on: February 04, 2014, 11:31:01 am »
Here is the code I added to prevent certain rows from being editable:

        obj.cellClick = function (event, ui) {
            var $td = $(this).find('.pq-cont tr[pq-row-indx=' + ui.rowIndx + '] td[pq-col-indx=' + ui.colIndx + ']');
            if (!$td.is('.gridRowEditable td')) {
                event.preventDefault();
                return false;
            }

        }

        obj.cellSelect = function (event, ui) {
            var $td = $(this).find('.pq-cont tr[pq-row-indx=' + ui.rowIndx + '] td[pq-col-indx=' + ui.colIndx + ']');
            if (!$td.is('.gridRowEditable td')) {
                event.preventDefault();
                return false;
            }
        }

Unfortunately this does not prevent the user from tabbing or using the keyboard to navigate to those cells. Any other suggestions?

Thank you.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: is it possible to make a particular cell not editable?
« Reply #3 on: February 04, 2014, 11:54:49 am »
You don't need to use low level API; there is specific API in PRO for the same task.

use this option for rows.
http://paramquery.com/pro/api#option-editable

and use this option for cells.
http://paramquery.com/pro/api#option-column-editable


Leo F

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: is it possible to make a particular cell not editable?
« Reply #4 on: February 04, 2014, 08:43:41 pm »
Thank you! I thought it was just for columns, missed the row part.