Comments (13)
I know it may be a little late for you, but I implemented this in my fork: https://github.com/crazy4chrissi/combo-tree
from combo-tree.
Hi,
I Want to change the Json value dynamically.But it displayed old value only. Json value not updated dynamically.
from combo-tree.
This issue and the whole JSON is about the initial data of the tree. "Initial" implies it is not dynamical ;)
So what you want to do is select a value using JS? By id? Of course you can just trigger click()
on the respective element to select/unselect an item. Sure, a predefined function for that would be handy.
from combo-tree.
Yes, I am done using id. Function invoke ajax call and pass data comboTree.But data not rendered. Initial data only displayed.dynamic data not worked.
from combo-tree.
I know it may be a little late for you, but I implemented this in my fork: https://github.com/crazy4chrissi/combo-tree
would it be possible to add an extra attribute selected=true|false to each json "leaf"? this way the plugin can set initial selection. I think that without this is not so much usefull
from combo-tree.
@blacktek What is the difference between what you propose and the preselect
attribute I added in my fork? Just add it to any leaf you want initially selected.
from combo-tree.
@blacktek What is the difference between what you propose and the
preselect
attribute I added in my fork? Just add it to any leaf you want initially selected.
sorry I didn't notice it; I manually edited the source to add this functionality :) I added a "disabled" property too in order to have nodes that are not selectable. Thank you!
from combo-tree.
one thing I made differently was adding at line 116 this code:
this._selectedItem = {
id: sourceItem.id,
title: sourceItem.title
};
this._selectedItems.push(this._selectedItem);
I didn't do the trigger('click') in the constructor; the proposed solution should be more cpu effective.
from combo-tree.
Guys, i did make changes and got setting value to work. Just add these functions along with other prototype functions and use it.
`
// Set Values
// *****************************
ComboTree.prototype.setValues = function (data) {
if (data !== null &&
data !== undefined &&
typeof data !== "string" &&
typeof data !== "number" &&
typeof data !== "function") {
if (data.length > 0) {
for (var k = 0; k < data.length; k++) {
this.manageValues(data[k]);
}
}
}
};
ComboTree.prototype.manageValues = function(sourceItem) {
var isThereSubs = sourceItem.hasOwnProperty("subs");
if (isThereSubs) {
var li = $('#' + this.comboTreeId + 'Wrapper li.ComboTreeItemParent');
li.find('span.comboTreeItemTitle[data-id=' + sourceItem.id + ']').trigger("click");
this.manageValues(sourceItem.subs);
} else {
$('#' + this.comboTreeId + 'Wrapper span.comboTreeItemTitle[data-id=' + sourceItem.id + ']').trigger("click");
}
};
`
Hope it helps. Enjoy! :)
Usage:
comboTree.setValues(objArr);
from combo-tree.
Hi all,
You can use setSelection
method of new version.
Thanks...
from combo-tree.
from combo-tree.
Hi all,
I am new to combo tree. how do i implement setSelection method
Could you please help on this
from combo-tree.
Uncaught TypeError: setSelection is not a function.
This error is coming while setting value using setSelection.
from combo-tree.
Related Issues (20)
- How to re-init a combotree after destroy it? HOT 6
- change event issues HOT 2
- How to filter in single tree?
- clearSelection is not working on single Tree HOT 4
- How to get id value in post form
- Change Colors... HOT 1
- combobox scrolling
- How to use this plugin in React component ? HOT 2
- How to deal of setSelection method when parent and child have the same id for dynamic data? HOT 1
- Combo Tree On safari not working
- How to get the selected value? HOT 3
- Hover to search result
- when data lacks ID, drop-down arrow icon disappears HOT 2
- get parent text during on-change/selected event
- how to disselect the selected option in single valued tree ( isMultiple = false ) ?
- Event firing when drop-down is closed?
- Return ids only after done cascading
- Not displaying data properly when pressing the Alt+Tab,F12 key combination, specifically when using single selection mode.
- Remove selected items HOT 5
- setSelection in 1.3.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from combo-tree.