Checkbox behavior in RadTreeView control - silverlight

I am using a Telerik RadTreeView control to build a tree with nodes containing checkboxes.
The default behavior for this control is that if you check a parent node, all of the child nodes within it will also become checked. Is there any way to change this behavior? I want to be able to check a parent node on or off and not have it affect the children.
Thanks

I would try doing some magic when the PreviewChecked event happens. I'm not sure, but maybe you can use it to detect a checkbox is about to become checked, and prevent this from happening if it is not the checkbox the user actually clicked in.

You could also do some stuff in javascript like this
function checkNode()
{
var selectedNode = treeView.get_selectedNode();
if (!selectedNode)
{
alert("You need to select a node first.");
return false;
}
selectedNode.set_checked(!selectedNode.get_checked());
return false;
}
This is straight from telerik but simply loop through all the children nodes and turn them back off (or back on when you click it off). The problem is if you want to maintain the state of the children nodes regardless of the parent. Then you need to hold that info in some variable.
The other option is if you don;t want the children to even have checkboxes, then simply don;t make those nodes "Checkable" in the server side code. (I'm sure there is a way in the client side too)

Related

ExtJs grid child tap event doesn't register correctly

I have an ExtJs grid that has a "childtap" event attached to it. (cmd 7.3 modern)
When I click an entry, it shows the location I clicked, using
onGridChildtap: function(list, location, eOpts) {
console.log(location);
}
and this is the contents of the location attribute:
However, let's say I try to hide the panel that contains the grid, then show it back again.
Then, without changing anything on the grid, the "location" content becomes the following:
Note that many object keys are missing, like column for example. This seems to happen at random, and I can not replicate it doing something specific. Sometimes it also get's back to normal by itself.
Is this a bug? Has someone ever come accross this unexpected behaviour?

list of Items, bulk operation sample

This might simple but I need some pointers.
I have a list of items which I am rendering using map list (Parent Component) and item(Child Component).
There is checkbox inside child component
Parent has a button
Now, I want user should able to select few or all items from the list, and on click of button we should highlight the checked items alone.
I tried some flag passing, however could not figure out best approach.
Please suggest.
Thanks all.
Finally, figured out by adding operation code in parent component.
Child component just get status update in case.

Dojo drop-down detaches when scrolling page containing FilteringSelect or ComboBox

Since the ComboBox and FilteringSelect use a 'dijitPopup' whose DOM element gets inserted just before the closing body tag (presumably to help with ensuring it appears above everything else z-index-wise) this means that if the ComboBox is contained in an element that scrolls independent of the window itself and the user opens the dropdown and then scrolls the window (or whatever containing element) using the scroll wheel, that the menu part doesn't move with the control itself.
Is there a straightforward way to ensure that the menu part of the view remains positioned correctly relative to the control itself rather than simply assuming that its starting position is ok?
EDIT: appears to be a known issue (http://bugs.dojotoolkit.org/ticket/5777). I understand why they put the dijit popup just before the closing body tag for z-index stacking and overflow clipping issues, but it seems like it's maybe not the ideal way to do things given the bug in question here and things like:
You can restrict the Dijit theme to only small portions of a page; you
do this by applying the CSS class of the theme to a block-level
element, such as a div. However, keep in mind that any popup-based
widget (or widgets that use popups, such as dijit.form.ComboButton,
dijit.form.DropDownButton, and dijit.form.Select) create and place the
DOM structure for the popup as a direct child of the body
element—which means that your theme will not be applied to the popup.
~ from http://dojotoolkit.org/documentation/tutorials/1.6/themes_buttons_textboxes/
Not sure if this is the very best solution, but here's what I came up with:
Since the widget may be programmatically added/removed, and to avoid coupling a solution with some particular surrounding markup that we can't always count on in all cases, what I did was to hook the _showResultList and _hideResultList methods of ComboBox and when the popup opens, traverse up the DOM till we reach the <html> tag, adding onscroll listeners on each ancestor.
The handler for the onscroll event is simply:
var myPos = dojo.position(this.domNode, true);
this._popupWidget.domNode.parentNode.style.top = '' + (myPos.y + myPos.h) + "px";
where this is the widget in question. I scope the handler to the widget using dojo.hitch. In the close method I remove the listeners. I have to clean up the code a bit before it's presentable, but when it's finalized I'll add it to this answer.
Note: I only show updating the y position here. Part of the cleanup is to add x position updating in case someone scrolls horizontally.
Though its old I just faced this same problem and it looks like a Dojo issue and the fix is available here https://bugs.dojotoolkit.org/changeset/30911/legacy

ExtJS FormPanel Only Rendered to Panel the First time it is Selected

My Form Panels need to be rendered based on a selection in an XML tree structure. However, my form panel for a specific node is only rendered the first time. When I change the selection to something else and return to the original selection, the form panel is not re-rendered.
It was rendering correctly based on the selection before when I had a simple Ext.Template and I did
var temp = Ext.getCmp('details-panel').body;
and then
(Ext.Template's name).overwrite(temp, node.attributes).
When I changed this overwrite line to
(Form Panel's name).render(temp), it only works the first time.
Any idea what I am missing? Thanks!
A component will only render once in ExtJS, after this you need to make use of doLayout() after adding and removing child components.
formPanel.doLayout();
I'm not sure I quite understand. I basically have
tp.getSelectionModel().on('selectionchange', function(tree, node){
var el = Ext.getCmp('temp-panel').body;
el.update("");
if(node && node.....){
myForm.render(el);
}
I want different form panels to show up based on which node I click on. So in the if (node && ...) block I need to render a specific formpanel everytime I switch my selection to this node. Right now it is only happening on the first time. Would calling myForm.doLayout() solve this issue?

Silverlight Control not working THAT good

I have this problem that I have a little menu with a croll bar.. inside there's a couple of items with checkboxes.. On iterating through these checkboxes I get a null error.It seems like this is caused whenever a checkbox is not part of the visible space of the menu thingy.. Like Silverlight only initiate the checkbox when you scroll down so it is visible..
Anyone have any idee how to get around this?
When iterating thru the checkboxes, try adding a check to see if you're actualy dealing with a checkbox and not something else that's in the elementtree.
Loop thru children
if(child is CheckBox){
// Do what you want with the checkbox
}

Resources