[Dojo-interest] Programmatic dojox/mobile/ScrollableView problem

Patrick Ruzand pruzand at gmail.com
Fri Jun 13 06:03:43 EDT 2014


Hi,

it appears there are several problems in the sample:
1/ the deviceTheme dependency should be be loaded via require() but
via a script tag. See
http://dojotoolkit.org/reference-guide/1.9/dojox/mobile/deviceTheme.html
for more info on this guideline.

2/ not all dojox mobile widgets support the innerHTML parameter. The
ScrollableView for example does not... (the reason is that the
innerHTML property is set after buildRendering() is called, on the
widget focusNode or domNode, resulting in destroying the internal
structure of the scrollableview).

3/ finally it seems since the toplevel view is created in markup, and
that the ScrollableView is created programmatically and added to it
later, it fails to compute its correct size. I still have to
investigate why, but you need to explicitely call view2.resize() at
the end.

here is a modified version of your sample:

parser.parse();

var htmlView1 = registry.byId("htmlView1");

var view2 = new ScrollableView();
var roundRect1 = new RoundRect({
innerHTML: "Hello from the Programmatic RoundRect"
}).placeAt(view2);
domStyle.set(roundRect1.domNode,
{
height: "1000px",
background: "blue",
color: "white"
});
view2.placeAt(htmlView1);
view2.resize();


Patrick

On Thu, Jun 12, 2014 at 6:13 PM, Diarmuid Quinn
<diarmuid.quinn at gmail.com> wrote:
> Hi,
> I'm having trouble with the mobile ScrollableView:
>
> Declarative - works well:
>
>    <div data-dojo-type="dojox/mobile/ScrollableView">
> </div>
>
> Programmatic - ScrollableView does not work while a View works as expected
> See this fiddle jsfiddle.net/BrassDev/AWW9K/70
> (set switchScrollableOn = true for ScrollableView, false for View)
>
> view2 = new ScrollableView({innerHTML: "the Programmatic ScrollableView"});
> doesn't work.
> view2 = new View({innerHTML: "the Programmatic View"}); works as expected
>
> What do I mean "it doesn't work"? Here's the generated HTML.
> <div class="mblView mblScrollableView" id="dojox_mobile_ScrollableView_0"
> widgetid="dojox_mobile_ScrollableView_0" style="overflow: hidden; top: 0px;
> background: green;"></div>
> - the child div (RoundRect) is not added
> - it doesn't include the innerHTML
> - it does pick-up the style.
>
> What am I doing wrong? Thanks in advance.
>
> Thanks!
>
> Diarmuid
>
> --
> Dojo Toolkit: http://dojotoolkit.org/
> Tutorials: http://dojotoolkit.org/documentation/
>
> Dojo-interest at mail.dojotoolkit.org
> To unsubscribe, visit:
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>



-- 
--
Patrick


More information about the Dojo-interest mailing list