Calling show on an element from another Kind?

I am trying to call show on a kind I have from another kind.

So I have my App.js Kind and in there I have a function from that function I want to call another function in a Panel that I have in a file called MyPanel.js

In that file I have a repeater and I set it to be hidden on the create function.

When I call show from my App.js as follows:

this.$.myRepeater.show();

Then the repeater shows but it doesn't seem to have the CSS styles applied to it, I have to click on the items for the CSS to apply.

Is there a better way to do this or am I missing something simple?

Comments

  • Here is a JS fiddle of what I am trying to do:

    http://jsfiddle.net/9U6NY/2/
  • edited February 2014
    So basically what happens is I init the repeater, hide it on the create function of the Panel and then later on I call .Show() on the repeater. The space for the repeater is taken up but it is completely blank, just white space

    EDIT: OK so some further testing shows the repeater actually does show but the CSS style is not applied to the rows it creates (White on White looked like it was missing)

    Why is the CSS style missing after I call .show(); ?
  • edited February 2014
    This is probably specific to your fiddle example, but you forgot to initialize the collection property to your data. It seems to work properly (i.e. via the show button) after adding that: http://jsfiddle.net/9U6NY/3/

    Maybe you can modify the updated fiddle to show what's occurring in your app.
  • Yes, sorry I was a bit rushed, I figured out I have to call .render() to get it to work but is this a bad idea and more of a work around?
  • Yeah it works because you're regenerating the entire repeater's markup into the dom again, which is probably not necessary and expensive. I'm curious how your implementation differs from the sample implementation in the fiddle, which doesn't require a render call when unhiding the repeater.
  • I got it working, I think the problem was that I was hiding the repeater in my Panel and then calling initRepeater at a bad time, I've changed it so that I only call initRepeater when I need to show the list. This seems to have worked.

    Apologies on the lack of code but I am working off a template that is quite complex and I cannot efficiently pull out the part I am working on
  • No worries! Glad you got it working :)
Sign In or Register to comment.