0

I wish to disable any modifications to any of the cells in the lefthand side pane of the Gantt view.

I've tried this CSS

.jsgrid-control-text
  {
     -webkit-user-select: none; /* Safari 3.1+ */
    -moz-user-select: none; /* Firefox 2+ */
    -ms-user-select: none; /* IE 10+ */
    user-select: none; /* Standard syntax */
    pointer-events: none
  } 

.ms-jsgrid-cell-selected-editable
{
     -webkit-user-select: none; /* Safari 3.1+ */
    -moz-user-select: none; /* Firefox 2+ */
    -ms-user-select: none; /* IE 10+ */
    user-select: none; /* Standard syntax */
    pointer-events: none
}

And this jQuery

  jQuery("td[role='gridcell']").attr('readonly', true);
  jQuery("td[role='gridcell']").css({'-ms-user-select': 'none','user-select': 'none', 'pointer-events': 'none'});

  jQuery("td[role='gridcell']").next('span').attr('readonly', true);
  jQuery("td[role='gridcell']").next('span').css({'-ms-user-select': 'none','user-select': 'none', 'pointer-events': 'none'});


  jQuery("tr[role='gridcell']").next('tr').next('tr').next('tr').css({'-ms-user-select': 'none','user-select': 'none', 'pointer-events': 'none'});
  jQuery("tr[role='gridcell']").next('td').next('td').next('td').css({'-ms-user-select': 'none','user-select': 'none', 'pointer-events': 'none'});

  $("div[id$='_ListViewWebPartJSGrid_leftpane']").css({'-ms-user-select': 'none','user-select': 'none', 'pointer-events': 'none'});

  jQuery("td[role='gridcell']").next('span').removeClass("jsgrid-control-text"); 

but have had no luck. Where have I gone wrong?

1
  • Interestingly I've stopped the click selection when using Chrome 66.0.33, but not IE11
    – southskies
    Commented Jun 5, 2018 at 3:08

1 Answer 1

1

I do surprise myself sometimes!

One line of code seems to do the trick, works for both IE and Chrome.

jQuery("td[role='gridcell']").on('mousedown', function() { return false; });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.