Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesn't work well with ajax. (select2 v4.0.3) #1

Open
linbren opened this issue Feb 8, 2017 · 0 comments
Open

doesn't work well with ajax. (select2 v4.0.3) #1

linbren opened this issue Feb 8, 2017 · 0 comments

Comments

@linbren
Copy link

linbren commented Feb 8, 2017

`$("#sajaxtree").select2tree({
			language : "zh-CN",
			multiple : "multiple",
			allowClear : true,
			ajax : {
				url : $webPath + 't.do?getFuncList',
				dataType : 'json',
				delay : 250,
				data : function(params) {
					var query = {
						search : params.term,
						page : params.page || 1,
						rows : 30,
						key : 'EXPERT_TEAM'
					}
					// Query paramters will be ?search=[term]&page=[page]
					return query;
				},
				processResults : function(data, params) {
					params.page = params.page || 1;
					var rows = data.rows;
					var newrows = [];
					for ( var i in rows) {
						var row = rows[i];
						/* 				row.id = row.funcCode;
										row.text = row.funcName;
										row.parent = row.parentCode; */
						newrows[i] = new Object();
						newrows[i].id = row.funcCode;
						newrows[i].text = row.funcName;
						newrows[i].parent = row.parentCode;
					}
					console.debug("ajax返回的对象是:")
					console.debug(newrows)
					return {
						results : newrows,
						pagination : {
							more : (params.page * 30) < data.total
						}
					};
				},
				cache : true
			},
			escapeMarkup : function(markup) {
				return markup;
			},
			templateResult : formatTreeRepo,
			templateSelection : formatRepoSelection
		});`

getFuncList return a simple json string of bean array .
it was display as a simple select2 object ,but not tree in droplist.

error on console:
"jquery-1.8.3.min.js:2 Uncaught RangeError: Maximum call stack size exceeded(…)"
nt @ jquery-1.8.3.min.js:2
find @ jquery-1.8.3.min.js:2
init @ jquery-1.8.3.min.js:2
v @ jquery-1.8.3.min.js:2
moveOption @ select2tree.js:33
(anonymous function) @ select2tree.js:35
each @ jquery-1.8.3.min.js:2
each @ jquery-1.8.3.min.js:2
moveOption @ select2tree.js:34
(anonymous function) @ select2tree.js:35
each @ jquery-1.8.3.min.js:2
each @ jquery-1.8.3.min.js:2
moveOption @ select2tree.js:34
(anonymous function) @ select2tree.js:35
each @ jquery-1.8.3.min.js:2
each @ jquery-1.8.3.min.js:2
moveOption @ select2tree.js:34
(anonymous function) @ select2tree.js:35
each @ jquery-1.8.3.min.js:2

@linbren linbren changed the title doesn't work well with ajax doesn't work well with ajax. (select2 v4.0.3) Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant