FilipBartos / heapbox

jQuery <selectbox> replacement

Home Page:https://is.gd/1GdRnV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic/Ajax heap box slider problems with heapsize

BuzzToneWeb opened this issue · comments

Hi nice job on the heapbox.
I've been working with the ajax method of updating select boxes for chained selects and have it working but have noticed an issue with the sliders.
I'll do my best to eplain and drop in some simpler code using the dynamic json method to recreate the issue.

When using long lists and using heapsize the dynamic methods and the sliders fail if the heapboxes aren't the same size, as in number of options.
On your website examples with the Ajax method it works fine because the options are the same number in each select.
To see the problem simply lose a few options on one of the selects and change the values.
It's like the heapsize isn't being updated and the sliders don't know when to stop scrolling.
I've looked through the code for a refresh function but the best I could find was the update function, which of course reverts the select box back to it's original state.

here's some code for you to see using the dynamic json method.

$(document).ready(function() {

    $(".basic-example").heapbox({"heapsize":"100px"});

$(".basic-example").heapbox();
json = '[{"value":"dynamic_value_1","text":"Dynamic value 1"},{"value":"dynamic_value_2","text":"Dynamic value 2"},{"value":"dynamic_value_3","text":"Dynamic value 3"},{"value":"dynamic_value_4","text":"Dynamic value 4"},{"value":"dynamic_value_5","text":"Dynamic value 5"}]';
$(".basic-example").heapbox("set",json);
$(".basic-example2").heapbox({
'onChange':function(){
    $(".basic-example2").heapbox("update");
    $(".basic-example").heapbox("update");}});});