Working with events


#1

Hi,
First, i want to say Hello to all the community.
Since 2 months im on learning curve. Mainly UI.
But now, i feel comfortable with coding views , and i want to start using compex things like getting data etc…
I’m front end coder, and i’m thinking as front end, and worst mistake was to tight connection with jquery. Now i suffer :frowning:

Even simple things like :


<Label class="grid"  tap="{{ loadPage }}" data-id="1"></Label>
<Label class="grid"  tap="{{ loadPage }}" data-id="2"></Label>
<Label class="grid"  tap="{{ loadPage }}" data-id="3"></Label>
 model.loadPage = function(args) {
         var button = args.object;
        console.log(this);
 };

Is a problem, beacuse i don’t know proper ways to

  • get this, i mean object that triggered event
  • get object data or any other, that triggered an event.
  • get a collection of similar items that share same class and only difference is for example data-attr
  • get this item, and addclass, and remove from all the rest for example

Maybe i missed some documentation, that points those things, so my question is, can anybody share some resources, that explains things like working with events.

Cheers,
Konrad


#2

One thing that i was able to archive was:

model.loadPage = function(e) {
        console.log(e.object['data-id']);
        //goToPage('dashboard/dashboard/dashboard','',true);
};

Now i can check what id tapped item has, and pass this into another page.
this is a pointer for new wiev, on what article to get (data-id=“number”)