bugfix
This commit is contained in:
parent
d6e0fcc291
commit
14fe45e623
@ -37,6 +37,7 @@ bricks.DataViewer = class extends bricks.VBox {
|
|||||||
this.scrollpanel.bind('max_threshold', this.load_next_page.bind(this));
|
this.scrollpanel.bind('max_threshold', this.load_next_page.bind(this));
|
||||||
await this.render();
|
await this.render();
|
||||||
this.set_key_select_items();
|
this.set_key_select_items();
|
||||||
|
bricks.debug_obj = this.scrollpanel;
|
||||||
}
|
}
|
||||||
async build_other(){
|
async build_other(){
|
||||||
}
|
}
|
||||||
@ -73,12 +74,6 @@ bricks.DataViewer = class extends bricks.VBox {
|
|||||||
this.filler_widget = new bricks.Filler({});
|
this.filler_widget = new bricks.Filler({});
|
||||||
this.add_widget(this.filler_widget)
|
this.add_widget(this.filler_widget)
|
||||||
this.scrollpanel = new bricks.VScrollPanel({});
|
this.scrollpanel = new bricks.VScrollPanel({});
|
||||||
/*
|
|
||||||
this.scrollpanel.set_css('scrollpanel');
|
|
||||||
this.scrollpanel.set_style('height','100%');
|
|
||||||
this.scrollpanel.set_style('width','100%');
|
|
||||||
this.scrollpanel.set_style('overflow','auto');
|
|
||||||
*/
|
|
||||||
this.filler_widget.add_widget(this.scrollpanel);
|
this.filler_widget.add_widget(this.scrollpanel);
|
||||||
}
|
}
|
||||||
async renderPageData(data, page){
|
async renderPageData(data, page){
|
||||||
@ -297,8 +292,8 @@ bricks.DataViewer = class extends bricks.VBox {
|
|||||||
var d = await this.loader.loadPreviousPage();
|
var d = await this.loader.loadPreviousPage();
|
||||||
if (d){
|
if (d){
|
||||||
this.dataHandle(d);
|
this.dataHandle(d);
|
||||||
var total = this.container.dom_element.scrollHeight - this.container.dom_element.clientHeight;
|
var total = this.scrollpanel.dom_element.scrollHeight - this.scrollpanel.dom_element.clientHeight;
|
||||||
this.container.dom_element.scrollTop = d.pos_rate * total;
|
this.scrollpanel.dom_element.scrollTop = d.pos_rate * total;
|
||||||
} else {
|
} else {
|
||||||
bricks.debug(this.loader, 'load previous page error');
|
bricks.debug(this.loader, 'load previous page error');
|
||||||
}
|
}
|
||||||
@ -320,8 +315,8 @@ bricks.DataViewer = class extends bricks.VBox {
|
|||||||
var d = await this.loader.loadNextPage();
|
var d = await this.loader.loadNextPage();
|
||||||
if (d){
|
if (d){
|
||||||
this.dataHandle(d);
|
this.dataHandle(d);
|
||||||
var total = this.container.dom_element.scrollHeight - this.container.dom_element.clientHeight;
|
var total = this.scrollpanel.dom_element.scrollHeight - this.scrollpanel.dom_element.clientHeight;
|
||||||
this.container.dom_element.scrollTop = d.pos_rate * total;
|
this.scrollpanel.dom_element.scrollTop = d.pos_rate * total;
|
||||||
} else {
|
} else {
|
||||||
bricks.debug(this.loader, 'load next page error');
|
bricks.debug(this.loader, 'load next page error');
|
||||||
}
|
}
|
||||||
@ -336,7 +331,7 @@ bricks.DataViewer = class extends bricks.VBox {
|
|||||||
var items = this.dom_element.querySelectorAll('[data-page="' + page + '"]');
|
var items = this.dom_element.querySelectorAll('[data-page="' + page + '"]');
|
||||||
for (var i=0;i<items.length;i++) {
|
for (var i=0;i<items.length;i++) {
|
||||||
var w = items[i].bricks_widget;
|
var w = items[i].bricks_widget;
|
||||||
this.container.remove_widget(w);
|
this.scrollpanel.remove_widget(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ var bricks = window.bricks || {};
|
|||||||
|
|
||||||
var low_handle = function(widget, dim, last_pos, cur_pos, maxlen, winsize){
|
var low_handle = function(widget, dim, last_pos, cur_pos, maxlen, winsize){
|
||||||
var max_rate = cur_pos / (maxlen - winsize);
|
var max_rate = cur_pos / (maxlen - winsize);
|
||||||
if (Math.abs(cur_pos + winsize - maxlen) < 1){
|
if (Math.abs(cur_pos + winsize - maxlen) < 5){
|
||||||
bricks.debug('fire max_threshold ......');
|
bricks.debug('fire max_threshold ......');
|
||||||
widget.dispatch('max_threshold');
|
widget.dispatch('max_threshold');
|
||||||
return
|
return
|
||||||
@ -47,7 +47,11 @@ bricks.HScrollPanel = class extends bricks.HBox {
|
|||||||
e.scrollLeft,
|
e.scrollLeft,
|
||||||
e.scrollWidth,
|
e.scrollWidth,
|
||||||
e.clientWidth);
|
e.clientWidth);
|
||||||
|
this.scroll_info = {
|
||||||
|
left:e.scrollLeft,
|
||||||
|
scroll_width:e.scrollWidth,
|
||||||
|
client_width:e.clientWidth
|
||||||
|
}
|
||||||
this.last_scrollLeft = e.scrollLeft;
|
this.last_scrollLeft = e.scrollLeft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,6 +89,11 @@ bricks.VScrollPanel = class extends bricks.VBox {
|
|||||||
e.scrollHeight,
|
e.scrollHeight,
|
||||||
e.clientHeight);
|
e.clientHeight);
|
||||||
this.last_scrollTop = e.scrollTop;
|
this.last_scrollTop = e.scrollTop;
|
||||||
|
this.scroll_info = {
|
||||||
|
top:e.scrollTop,
|
||||||
|
scroll_height:e.scrollHeight,
|
||||||
|
client_height:e.clientHeight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user