For following configuration, when all childs
of a node are selected, parent nodes are also counted. It causes
misunderstanding. If it is not possible to count only leaves, how can a fixed message be displayed.
checkboxes: { checkChildren: true },
messages: {
singleTag: " selected"
},
tagMode: "single",
checkboxes: { checkChildren: true },
messages: {
singleTag: " selected"
},
tagMode: "single",
7 Answers, 1 is accepted
0
Hi Hüseyin,
The DropDownTree does not provide a possibility to configure a tagTemplate similar to the MultiSelect
When the DropDownTree has tagMode 'single', the message can be configured through the messages.singleTag configuration. However, as you pointed out, the count of the selected node is added to the message and the parents nodes are also counted. To avoid displaying the count of the nodes, I would suggest you to subscribe to the close event of the DropDownTree and hide the element that contains the nodes count.
Here is a Dojo example where a custom message is displayed, without showing the total checked nodes count.
In case you think, that a tagTemplate would be a valuable addition to the DropDownTree I would suggest you to log the idea in our Feedback Portal. Based on the popularity it gain from the community it could be considered for future implementation.
Regards,
Neli
Progress Telerik
The DropDownTree does not provide a possibility to configure a tagTemplate similar to the MultiSelect
When the DropDownTree has tagMode 'single', the message can be configured through the messages.singleTag configuration. However, as you pointed out, the count of the selected node is added to the message and the parents nodes are also counted. To avoid displaying the count of the nodes, I would suggest you to subscribe to the close event of the DropDownTree and hide the element that contains the nodes count.
close:
function
(e) {
$(
'.k-dropdowntree .k-multiselect-wrap li.k-button>span:first-child'
).hide()
},
In case you think, that a tagTemplate would be a valuable addition to the DropDownTree I would suggest you to log the idea in our Feedback Portal. Based on the popularity it gain from the community it could be considered for future implementation.
Regards,
Neli
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Hüseyin
Top achievements
Rank 1
answered on 17 Sep 2018, 07:09 AM
Thank you Neli.It worked.
0
Andrea
Top achievements
Rank 2
Iron
answered on 09 Mar 2019, 09:37 AM
Still no way to exclude the parent nodes from the items count?
0
Hello,
While excluding parent nodes from the items count is not yet implemented, it is possible to achieve such custom behavior through using the widget's API and jQuery. Here's a dojo example, which demonstrates how you can manually calculate the number of checked/unchecked leaf nodes, exclude parent nodes, and then set the message to the respective span element with jQuery.
Regards,
Ivan Danchev
Progress Telerik
While excluding parent nodes from the items count is not yet implemented, it is possible to achieve such custom behavior through using the widget's API and jQuery. Here's a dojo example, which demonstrates how you can manually calculate the number of checked/unchecked leaf nodes, exclude parent nodes, and then set the message to the respective span element with jQuery.
Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Andrea
Top achievements
Rank 2
Iron
answered on 12 Mar 2019, 05:07 PM
Almost… please check this scenario: https://dojo.telerik.com/AcUJuXuM/2
With: checkChildren: true, autoClose: false, and the hide also on the change event.
Clicking on child nodes the count works, clicking on parent nodes the count fails.
0
Hello,
When checkChildren is set to true checking/unchecking a parent node respectively checks/unchecks the child nodes. In that scenario the check event does not fire for the child nodes. This requires a change to the logic that calculates the number of checked child items in the check event:
Updated dojo example.
Regards,
Ivan Danchev
Progress Telerik
When checkChildren is set to true checking/unchecking a parent node respectively checks/unchecks the child nodes. In that scenario the check event does not fire for the child nodes. This requires a change to the logic that calculates the number of checked child items in the check event:
check:
function
(e) {
var
dataItem = e.sender.dataItem(e.node);
if
(dataItem.hasChildren) {
dataItem.checked ? count += dataItem.items.length : count -= dataItem.items.length;
}
else
{
dataItem.checked ? count++ : count--;
}
var
string =
"item("
+ count +
") selected!"
;
$(
'.k-dropdowntree .k-multiselect-wrap li.k-button>span:eq(1)'
).text(string);
}
Updated dojo example.
Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Andrea
Top achievements
Rank 2
Iron
answered on 02 Apr 2019, 04:45 PM
Now is perfect! Thanks