Our application is using a simple master/detail deisgn with the master being the Grid and Detail a form.
When user chooses edit mode for the detail form we need to disable the Master grid to prevent Master/Detail synchronization which is done through setOnSelectStateChanged(doOnRowStateChanged) handler.
To do this we need a way to disable rowselection functionality of the grid - that is no mouse/keyboard events should be able to change the current row selection and trigger OnRowStateChanged handler.
Is there a way to temporarily disable a grid in this way?
Thank you,
Stan.
You may disable rowSelecting and mouse navigation events in next way
var keydis= mygrid.attachEvent(“onKeyPress”,function(){ return false; });
var seldis= mygrid.attachEvent(“onBeforeSelect”,function(){ return false; });
… and to return back to selectable state
mygrid.detachEvent(keydis);
mygrid.detachEvent(seldis);
I have tried this approach:
while in the “ReadOnly” mode simulated with the above two events disabled:
- could still click on another row with following outcome: lost the current row selection (higlight dissappeared from curent row - this should not happen);
and the clicked row did not get selected (this is ok).
- the setOnSelectStateChanged(doOnRowStateChanged) was still called, this time with currentRowId = null.
Seems like the above approach works only partially by not allowing to select a row. However, it does not provide for preserving the currently selected row.
Is there a workaround for this porblem?
Thank you,
Stan.
Hi,
It seems like we need to disable mouse handling events on the Grid. This way user would not be able to click on annother row in the Gird and that would take care of rowselection.
Is there a handle for the mouse events that can be disabled in the same manner as Key Events?
Regards,
Stan.
It not universal but next can be used
var temp=this.grid._doClick();
this.grid._doClick=function(){};
all mouse related functionality is disabled now ( except single click edit , but it probably not actual in your case)
to restore back
this.grid._doClick=temp;
Hi,
I have tried the last approach: var temp=this.grid._doClick();
It generates the following error:
Line: 90
Char: 176
Error: ‘srcElement’ is null or not an object
Code: 0
Is there a workaround?
Thank you,
Stan.
Sorry, my typo, of course it must look as
var temp=this.grid._doClick; //without brackets
this.grid._doClick=function(){};
…
this.grid._doClick=temp;
Great, it works!
Thanks a lot!
Stan.