Committed by
xuqi
select address and close, switch address and reset next levels
Showing
1 changed file
with
16 additions
and
6 deletions
@@ -106,6 +106,8 @@ function selectDistItem(options) { | @@ -106,6 +106,8 @@ function selectDistItem(options) { | ||
106 | distItemAreaId = options.distItemAreaId, // 当前选中areaId | 106 | distItemAreaId = options.distItemAreaId, // 当前选中areaId |
107 | config = options.config; | 107 | config = options.config; |
108 | 108 | ||
109 | + var from; | ||
110 | + | ||
109 | if (distElement.hasClass('checked')) { | 111 | if (distElement.hasClass('checked')) { |
110 | // TODO | 112 | // TODO |
111 | // distElement.removeClass('checked'); | 113 | // distElement.removeClass('checked'); |
@@ -125,11 +127,19 @@ function selectDistItem(options) { | @@ -125,11 +127,19 @@ function selectDistItem(options) { | ||
125 | config.url = setRequestUrl(config, currAreaId); | 127 | config.url = setRequestUrl(config, currAreaId); |
126 | 128 | ||
127 | // 选择之后关闭当前panel | 129 | // 选择之后关闭当前panel |
128 | - // distItem.trigger('click'); | ||
129 | - | 130 | + distItem.trigger('click'); |
131 | + | ||
132 | + // console.log('current level:', level) | ||
133 | + // console.log('distItemAreaId:', distItemAreaId) | ||
134 | + // console.log('currAreaId:', currAreaId) | ||
130 | // 当前点击的和已选择的不同,再渲染下一级目录 | 135 | // 当前点击的和已选择的不同,再渲染下一级目录 |
131 | if (level && distItemAreaId !== currAreaId) { | 136 | if (level && distItemAreaId !== currAreaId) { |
132 | - resetNextLevel(level - 1, config); | 137 | + from = level; |
138 | + while(from >= 1) { | ||
139 | + resetNextLevel(from - 1, config); | ||
140 | + from--; | ||
141 | + } | ||
142 | + | ||
133 | $(config.el).trigger('ca.afterInit', [config, level - 1]); | 143 | $(config.el).trigger('ca.afterInit', [config, level - 1]); |
134 | } | 144 | } |
135 | } | 145 | } |
@@ -137,8 +147,8 @@ function selectDistItem(options) { | @@ -137,8 +147,8 @@ function selectDistItem(options) { | ||
137 | 147 | ||
138 | // 获取初始化数据 | 148 | // 获取初始化数据 |
139 | function fetchInitialData(evt, config, level) { | 149 | function fetchInitialData(evt, config, level) { |
140 | - var distItemAreaId = $('.items-indicator .open input').val(), | ||
141 | - ajaxSettings = $.extend({}, config.ajaxSettings, { | 150 | + //var distItemAreaId = $('.items-indicator .open input').val(), |
151 | + var ajaxSettings = $.extend({}, config.ajaxSettings, { | ||
142 | url: config.url | 152 | url: config.url |
143 | }); | 153 | }); |
144 | 154 | ||
@@ -176,7 +186,7 @@ function fetchInitialData(evt, config, level) { | @@ -176,7 +186,7 @@ function fetchInitialData(evt, config, level) { | ||
176 | level: level, | 186 | level: level, |
177 | target: $(this), | 187 | target: $(this), |
178 | panel: currPanel, | 188 | panel: currPanel, |
179 | - distItemAreaId: distItemAreaId, | 189 | + distItemAreaId: currPanel.prev().find('input').val(), |
180 | config: config | 190 | config: config |
181 | }); | 191 | }); |
182 | }); | 192 | }); |
-
Please register or login to post a comment