@Fran-Diox
YES!!!
I’ve used the infinite-list one (not the lazy-repeat tutorial code) and with your ‘init’ code it works! Great!
SO!
All the code of each page MUST be written into this init function, so I know that it works, am I wrong?
@Fran-Diox
YES!!!
I’ve used the infinite-list one (not the lazy-repeat tutorial code) and with your ‘init’ code it works! Great!
SO!
All the code of each page MUST be written into this init function, so I know that it works, am I wrong?
@Fran-Diox
Ok I write the code when you send me (thanks for your time).
The code you’ve sent me run without issues but nothing is written into the list box.
I’ve thought that the basic template will work out-of-the-box with the tutorial’s code.
@Fran-Diox
Ok I’ve edited the message above meanwhile you’re writing your post :)
I’m using the swipe template.
This is the homepage where I’m trying to show the list:
<ons-template id="home.html">
<ons-page>
<ons-toolbar>
<div class="left">
<ons-toolbar-button onclick="fn.open()">
<ons-icon icon="md-menu"></ons-icon>
</ons-toolbar-button>
</div>
<div class="center">
The Title
</div>
</ons-toolbar>
<p style="text-align: center; opacity: 0.6; padding-top: 20px;">
Swipe right to open the menu!
</p>
<ons-list id="list">
<ons-lazy-repeat>
<ons-list-item>--</ons-list-item>
</ons-lazy-repeat>
</ons-list>
</ons-page>
</ons-template>
@Fran-Diox I moved that line outside the function and the error is still there. I’ve used javascript to get the element $('#element');
but there are errors like “refresh is undefined”.
I’m trying other things:
var lazyRepeat = document.querySelector('#list');
//var lazyRepeat = $('#list');
ons.ready(function() {
//window.addEventListener('load', function() {
//var lazyRepeat = $('#list');
lazyRepeat.delegate = {
calculateItemHeight: function(index) {
// Specify this if the height depends on the element.
return 40;
},
createItemContent: function(index, template) {
var dom = template.cloneNode(true);
dom.innerText = "List item #" + index;
return dom;
},
countItems: function() {
// Return number of items.
return 100000000;
},
destroyItem: function(index, item) {
// Optional method that is called when an item is unloaded.
console.log('Destroyed item with index: ' + index);
}
};
console.log(lazyRepeat);
});
This code is in the app.js file that I
<script src="js/app.js"></script>
at the end of the index file.
Thanks :smiley:
I had to move a 3-time-rewritten huge project from Angular 1 to 2 and I had to give up after 4 updates that changed several basic stuff.
I’ve lost a 2 years work that was needed to open a startup company. Very very sad.
NOW.
I use plain javascript. I don’t want multiple nested frameworks anymore. If one change something everything must be rewritten (or at least follow the several changes).
Hi.
I’m stuck at the first lines of my experience with OnsenUI.
I’ve copied and pasted the code found on the tutorial page about lazyRepeat and infiniteList.
Both throws:
TypeError: null is not an object (evaluating 'lazyRepeat')
I’ve added jQuery too, so I’ve tried to change the var lazyRepeat = document.querySelector('#list');
with var lazyRepeat = $('#list');
and the errors are gone BUT nothing happen.
I’ve used this tutorial for lazyRepeat and this for the infiniteList (and this too).
I really want to use Onsen (I’m moving from Ionic that messed all up with the version 2 of AngularJS) but I’m really stuck and can’t get why.
Thanks
Mac OSX 10.11.6
Command Line Interface for Monaca and Onsen UI
Monaca CLI Version 2.1.3