Open yuraloginoff opened 11 years ago
Of course I can filter through the items:
$('#activities')
.children()
.filter(function (index) {
if ( index !== 0 && index % 2 === 0 ) return $(this);
})
.remove();
But is there any better way to so this?
Replace all the options with an object content, difference the first element adding the attribute value
that will be an option:
var activities = [
{activity: 'Choose activty'},
{activity: 'Jogging'},
{activity: 'Gym'},
{activity: 'Sky Diving'}
];
var directives = {
'activity': {
'html' : function(){
return this.activity;
},
'value' : function(){
if(this.activity !== 'Choose activty'){
return this.activity;
}
}
}
};
$('#activities').render(activities, directives );
Same issue here. @ivangrimaldo solution can't help me.
I have this pagination template:
<ul class="pagination">
<li>
<a href="?page=-1" class="paginator-page-link-prev">«</a>
</li>
<li class="paginator-page active">
<a href="?page=1" class="paginator-page-link">1</a>
</li>
<li>
<a href="?page=+1" class="paginator-page-link-next">»</a>
</li>
</ul>
How can I exclude first and last <li>
element from render?
Hi @flaviolaino sorry for delay.
DO you have a plunkr with your code to check how It works please, will be useful.
@ivangrimaldo https://jsfiddle.net/derwke3a/1/
Still having problems?
@ivangrimaldo uh? Why? What has changed? Do you see the fiddle?
I mean did you resolve it? jojo
@flaviolaino Choose one
should not be part of template. Or you put it at your JSON and render it, or preserve it into de HTML but do not capture it when calling render
@dlibanori can I not capture some element when calling render? How?
@flaviolaino change your query
@dlibanori what do you mean?
Can I exclude internal element when calling render
function?
@flaviolaino I was thinking that render just valid pages would be easier but I'm wrong. The second option you have is just to render first and last page as one of your data. I can't see why this wouldn't work for you. Actually, I think this should be best option cause you may need to change your <li>
class when user pick the first/last page. May you explain why do you think it doesn't work for you?
I need to exclude first option element from select before render(). I have:
JS code is:
The output is:
Of course it's not what i need. I need the following:
Please give me an advise what i'm doing wrong. Thanks in advance!