PDA

View Full Version : [CLOSED] How to disable Right Click selection in Grid/Tree panel ?



inteligencija
Sep 13, 2012, 9:19 AM
Hi ,

As Title said , I want to disable right click selection in tree panel .

I tried


<ext:TreeSelectionModel ID="tsmRepPosition" runat="server" IgnoreRightMouseSelection="true"/>

but no luck :(

I need this for resolving issue explained below :
I use
select direct event (showing details of selected node in another formpanel)
with ItemContextMenu . Problem is that context menu does not appears because select direct event fires .
Only after another right click on nude (already selected)context menu appears
Any suggestion appreciated
Thanks

Daniil
Sep 13, 2012, 12:09 PM
Hi,

IgnoreRightMouseSelection prevents selection if any other node is already selected only.

I can suggest the following solution.

Example

<ext:TreeSelectionModel runat="server">
<CustomConfig>
<ext:ConfigItem
Name="allowRightMouseSelection"
Value="function () { return false; }"
Mode="Raw" />
</CustomConfig>
</ext:TreeSelectionModel>

inteligencija
Sep 13, 2012, 1:19 PM
I can suggest the following solution.

Example

<ext:TreeSelectionModel runat="server">
<CustomConfig>
<ext:ConfigItem
Name="allowRightMouseSelection"
Value="function () { return false; }"
Mode="Raw" />
</CustomConfig>
</ext:TreeSelectionModel>

This isn't working for me . I can not select anything with left click

Daniil
Sep 13, 2012, 3:45 PM
Confirm, apologize for the inconvenience.

Please update from SVN, 2.1 branch and use:

Example

<script type="text/javascript">
var allowRightMouseSelection = function (e) {
var disallow = this.ignoreRightMouseSelection && e.button !== 0;

return !disallow;
}
</script>

<ext:TreeSelectionModel runat="server" IgnoreRightMouseSelection="true">
<CustomConfig>
<ext:ConfigItem
Name="allowRightMouseSelection"
Value="allowRightMouseSelection"
Mode="Raw" />
</CustomConfig>
</ext:TreeSelectionModel>

inteligencija
Sep 14, 2012, 7:31 AM
Thanks for replay . This is working but I was not able to resolve my problem with context menu.

Problem is that I want to have selected node on right click but not to fire select direct event (I want to fire select DE when left click )
so, is there a way to distingush right and left click to fire different events (left- select DE , right - Context menu and node should be selected in both ways )


Thanks for Your time

Daniil
Sep 14, 2012, 7:49 AM
Problem is that I want to have selected node on right click but not to fire select direct event (I want to fire select DE when left click )

Please clarify why do you need this node to be selected? You could get a right clicked node within an ItemContextMenu listener.

inteligencija
Sep 14, 2012, 7:55 AM
Please clarify why do you need this node to be selected? You could get a right clicked node within an ItemContextMenu listener.


I use context menu for delete action in code behind (using selectedrecordID ) . I will resolve my problem if I could pass extra param in select DE about type of click used fore selection

inteligencija
Sep 14, 2012, 8:06 AM
I resolved my problem.


I removed submask from Select DE and now everything works fine .

Thanks for your trouble Dannii

Daniil
Sep 14, 2012, 2:37 PM
I use context menu for delete action in code behind (using selectedrecordID ).

I would pass a node id with an ItemContextMenu event without selection.



I removed submask from Select DE and now everything works fine .


I didn't know how exactly it helped, but it is definitely good that is works now.

I am marking the thread closed. If you will need more assistance, you are welcome.