Author Topic: Prevent fill of certain cells  (Read 1888 times)

srmooney

  • Pro OEM
  • Newbie
  • *
  • Posts: 4
    • View Profile
Prevent fill of certain cells
« on: July 24, 2020, 07:03:29 pm »
Hello,

Is there a way to prevent certain cells being "filled" when using the fill handle?
We want the user to only be able to fill certain cells. We have this started by using the "beforeFillHandle" event to limit what cells have the fill handle and we restrict the filling to "horizontal".
Is there another event that we can use to prevent or revert a cell that we don't want to be filled?

i.e. the first column in our grid is the users name, then after is a column for every week that they have request with the hours for the week. We want them to only be able to "fill" the week columns.


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Prevent fill of certain cells
« Reply #1 on: July 24, 2020, 08:37:08 pm »
yes you can use beforeValidate event for more finer control.

https://paramquery.com/pro/api#event-beforeValidate

ui.updateList is an array of newRow, oldRow objects, you can delete values from newRow according to the columns required / skipped.

Code: [Select]
beforeValidate: function(evt, ui){
  if( ui.source == 'paste' ){
    //mutate ui.updateList
  }
}

Please let me know if you need further assistance on this.
« Last Edit: July 24, 2020, 08:38:56 pm by paramvir »

srmooney

  • Pro OEM
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Prevent fill of certain cells
« Reply #2 on: July 24, 2020, 09:21:02 pm »
That works, thank you!