Author Topic: Disable undo option for Tree addNodes action  (Read 2242 times)

Digitalsoft

  • Pro OEM
  • Newbie
  • *
  • Posts: 49
    • View Profile
Disable undo option for Tree addNodes action
« on: June 24, 2020, 11:30:13 pm »
It is mentioned in doc that 'Undo is supported and ui.source = "addNodes" in the events fired during the process' for addNodes action in Trees. Incase if we need to disable undo option and addNodes changes irreversible then do we have any option for the same, thanks!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Disable undo option for Tree addNodes action
« Reply #1 on: June 25, 2020, 10:15:07 am »
History undo / redo can be disabled by setting

historyModel.on = false

https://paramquery.com/pro/api#option-historyModel

Digitalsoft

  • Pro OEM
  • Newbie
  • *
  • Posts: 49
    • View Profile
Re: Disable undo option for Tree addNodes action
« Reply #2 on: June 25, 2020, 10:28:00 am »
We require to have historyModel for redo / undo for other action like cell update, cut/copy/paste in grid. Only that we don't want to track during tree lazy loading(through addNodes). In addRow method, there is option to limit the history specific to that operation. We are looking for anything similar to that in addNodes or any other way to achieve.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Disable undo option for Tree addNodes action
« Reply #3 on: June 25, 2020, 10:33:05 am »
That makes sense.

There is alternative way to disable history specifically for addNodes.

Code: [Select]
beforeValidate: function(evt, ui){
if(ui.source=="addNodes"){
ui.history=false;
}
},
« Last Edit: June 25, 2020, 11:41:09 am by paramvir »

Digitalsoft

  • Pro OEM
  • Newbie
  • *
  • Posts: 49
    • View Profile
Re: Disable undo option for Tree addNodes action
« Reply #4 on: June 26, 2020, 11:31:57 am »
Perfect, it does the job for our requirement..thanks!