Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the view via .add() #3

Open
FokkeZB opened this issue Aug 20, 2014 · 4 comments
Open

Set the view via .add() #3

FokkeZB opened this issue Aug 20, 2014 · 4 comments

Comments

@FokkeZB
Copy link

FokkeZB commented Aug 20, 2014

I'd like to be able to set the view via a .add() method:

var myListView = Ti.UI.createListView({
    height: Ti.UI.FILL,
    width: Ti.UI.FILL
});

var swipeRefreshModule = require('com.rkam.swiperefreshlayout');
var swipeRefresh = swipeRefreshModule.createSwipeRefresh({
    height: Ti.UI.FILL,
    width: Ti.UI.FILL
});

swipeRefresh.add(myListview);

$.content.add(swipeRefresh);

This will allow me to use the module in Alloy XML:

<Alloy>
  <Window>
    <SwipeRefresh module="com.rkam.swiperefreshlayout">
      <ListView>
        <!-- listview tags -->
      </ListView>
    </SwipeRefresh>
  </Window>
</Alloy>
@sakae-nakajima
Copy link

+1 for this

If this was available, I was not caught with this one:
#5

@saggy
Copy link

saggy commented Oct 29, 2014

Is there is another solution to add the listview in a module in xml as above fokke mentioned..?
beacuse i need to add the listview in xml.

@FokkeZB
Copy link
Author

FokkeZB commented Oct 29, 2014

You can always do it via a widget:

index.js

<Widget src="myWidget">
  <ListView />
</Widget>

widget.js

var swipeRefreshModule = require('com.rkam.swiperefreshlayout');
var swipeRefresh = swipeRefreshModule.createSwipeRefresh({
  view: arguments[0].children[0]
});
$.setTopLevelView(swipeRefresh);

(coded it here, haven't checked)

@iskugor
Copy link

iskugor commented Oct 30, 2014

You can check out 0.3 version in my repo: https://github.com/iskugor/Ti.SwipeRefreshLayout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants