| Page 1 of 1 | [ 6 posts ] |
|
Hello,
I have a div with a size that can vary (it is a shopping cart) and I render it using a scrollable view. Each time an object is added to or remove from the cart, I create a new ScrollView object which I render to have my scrollbale view rendered with the right size, able to show the whole cart. Is there a better way to update the current scrollview object to achieve this goal ? How you guys are you doing for such a purpose ? Thanks in advance for all your tips. Lionel Code: [...] function createScrollView2 () { var scrollview2 = new Y.ScrollView({ srcNode:"#scrollable2", height:"429px" }); scrollview2.render(); } [...] function completeAddToCart (id, o, args) { eval('var obj = ' + o.responseText); addElementToCart (obj); createScrollView2(); } [...] |
|
Hello,
Perhaps my way is the best way But I still have a doubt about it, so I "up" this topic Thank you for reading |
Juan Ignacio DopazoYUI Contributor
|
You can change the size of any widget, including ScrollView, by setting the "width" or "height" attribute.
Code: scrollview.set('height', 400); Creating multiple widgets just for changing their size can become slow very quickly. |
|
¡Gracias Juan!
Well I perhaps used the wrong words to explain what I am trying to do. The scrollable viewport stays the same size. But the content scrolled (the one that does not fit in the viewport) is refreshed and its size changes. When the size of this content changes (I add a product to the shopping cart for example) then I can view the content that was added by scrolling down using the elastic bouncing behavior of the scrollview but if I release the click (or the touch), this new content is not visible and I cannot scroll down to it. It seems that the scrollview object is not aware that the scrolled content has a new height. Thanks for reading. Lionel |
Juan Ignacio DopazoYUI Contributor
|
I made a jsfiddle to try this out. http://jsfiddle.net/juandopazo/wHSFu/1/
If I understood correctly how ScrollView works, you just need to call scrollview.syncUI() after adding content to it. |
|
Juan ! You made my day !
Thank you so much for the answer and for the example. Lionel |
| Page 1 of 1 | [ 6 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group