EXTJS: nodes deselected in multi-select tree panel on right click (itemcontextmenu) - extjs

I have a tree panel which has multiselect enabled (selModel:{MODE:MULTI}). If multiple nodes are selected then you right click to activate context menu, all selected nodes except for node that was right clicked on get deselected.
The outcome im looking for is the nodes stay selected, so I can click a menu item and get IDs of all selected Nodes.
There was a bug created for this issue couple years ago and Sencha introduced a new config, ignoreRightMouseSelection, which if set to true, doesnt treat a right click as a selection. But this config is for RowModel. I am using a tree Panel.
The event I'm listening for is treepanels "itemcontextmenu", to show contextmenu
any help appreciated, thanks

I fixed this problem by adding one more parameter to selModel.
selModel: (
{
mode: 'MULTI', ignoreRightMouseSelection:true
})
Try it.

Related

Extjs : clear selections in item selector

What I have is I have an item selector with available users and assigned users as two different columns. On clicking any user in the available users and clicking a different menu option, the selected user from the available users columns is still displayed. How do I clear the selection upon clicking a different menu ?
Here's how the screen looks with the selection under a particular menu :
And here's the selection again after opting a different menu :
I tried, accessing the store and clearValue() and setValue('') which is not right solution and I was not able to access the selecitonModel to perform clearSelections() here.
How do I clear the selections upon clicking menu?
Would greatly appreciate your help, thanks a lot.
You can use the getSelectionModel().deselectAll() method of the "Users View" (that you want to clear the selection) within the listener select from the "Roles View". This will cause all user record selections to be removed when selecting a different menu. See docs: getSelectionModel, deselectAll.
Example:
{
xtype: 'dataview',
.
.
.
listeners: {
select: function(dataview, record, index, eOpts){
dataview.view.up('viewport').down('#usersView').getSelectionModel().deselectAll();
}
}
}
Within the listener, it performs the method to deselect all records from the target view.
These methods are commonly found in components that have the selection behavior, such as the grid.
See this fiddle: Deselect DataView Items.
store.removeAll();
is this what you are looking for

Sencha Touch - Nested List - Refreshing a list item. (Using getItemTextTpl to se Template )

I have a nested list with a template by using getItemTextTpl. Template is simple it checks for a flag and if true it shows a button on a list item. If false show no button.
When on the list item I press the button (It's a delete button) I want to refresh that list item to not show the button. To make the button change I have to navigate up two levels and back down for it to update the list item.
My problem is getting the list item to refresh/Update. Can force the template to check the list item again etc? I can get the button to fire the event.
Thanks!
for the display layer:
why not just use css to apply/change the class of the delete button to hide it? then you don't have to refesh anything.
then you can programically set the value in your code, or send to the server to make sure the status is set when the view reloads at another point.

Multi select treeview that supports drag of multiple Items in WPF

I was searching for possible solution for hours and could not find any.
Hopefully someone can help me.
I managed to implement Multi Select WPF TreeView using the following answer: https://stackoverflow.com/a/6681993/1679059
It works nicely but I want to be able to drag selected items and drop them into the DataGrid.
In PreviewMouseMove event handler previously selected items get deselected so I can't prevent that from happening.
I was trying to prevent deselecting items in PreviewMouseLeftButtonDown event handler but at that point I cannot know if a user intends to select an item or drag selected items.
Can someone help me with that problem?
you can do this by adding a bool variable let say 'isLeftClick' in MouseLeftButton Event change isLeftClick to 'TRUE' and in MouseMove event check if isLeftClick is true or false if it is true then user thn user is trying to drag.
also check if mouse is pointed on one of selected nodes thn drag those nodes if it is on some unselected node then select that node and drag it.

ExtJs: Programly select rows of a GridPanel in an inactive tab not working?

Basicly, I have a window contains two tabs, the second tab is a GridPanel and is initially inactive.
I want to programly select two rows of this GridPanel(via CheckboxSelectionModel) by clicking a "show window" button , but found it not working. There will be a javascript error thrown and no rows selected. After I manually clicked the second tab to make the grid visible, everything works well.
what's the most possible mistake I made?
I'll paste the code soon if it's not a common mistake for extjs beginner.
This is because your tabpanel will not render any components that are not visible (i.e., any components in your second tab in this case).
If you add the following config option to your Ext.TabPanel it should fix your problem:
deferredRender: false

ExtJS TreeGrid - Context Menu anchors incorrectly

I have an ExtJS TreeGrid which I'm attempting to add a ContextMenu onto when a user right clicks. The right click is working fine, but there's one little niggle; the menu doesn't show in the exact position where the user right clicks. Rather, it anchors to the beginning of the node - so if a user right clicks half way across the node they need to travel across the screen to click on a menu item - quite annoying.
This seems a little odd as I have this exact feature working perfectly for the ExtJS Tree. Perhaps it's an ExtJS TreeGrid bug?
Why isn't the contextMenu showing exactly where the user right-clicks in the Tree Grid?
Here's the listener:
listeners: {
contextmenu: function(node,event){
node.select();
myContextMenu.show(node.ui.getAnchor());
}
}
Thanks!
EDIT:
On further inspection, the same thing is happening within the ExtJS Tree - perhaps this can't be avoided?
Apologies for answering my own question, but this sorts it:
listeners: {
contextmenu: function(node,event){
node.select();
myContextMenu.showAt(event.xy);
}
}

Resources