$(this).attr("event-item-id") no longer working after the latest upgrade

This forum contains topics that were moved from Get Satisfaction
Wai Pak
Posts: 0
Joined: Sat Sep 06, 2014 11:18 pm

$(this).attr("event-item-id") no longer working after the latest upgrade

Post by Wai Pak »

Before the latest upgrade, I used the following code after a successful DB read to fill a grid:

element.attr("event-item-id", value.IDauto);
element.attr("event-item-id",value.id);

so each row of the grid will have these two pieces of hidden data.

When some clicks on a row of the grid, I have JS to do this:

localStorage.setItem("itemId", $(this).attr("event-item-id"));
localStorage.setItem("eventDetailDBId", $(this).attr("event-item-_id"));

Now this piece of code no longer working. Anyone has any idea on how to fix it or is it a bug?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

$(this).attr("event-item-id") no longer working after the latest upgrade

Post by Yurii Orishchuk »

Hi Wai,

This code works for me.

Here is details: http://prntscr.com/4rcsor/direct

Also, here where i used this code: http://prntscr.com/4rcsu0/direct

So please give us more details about where you use this code and please take a look into HTML components(via browser debugger) and check whether your element has these custom attributes.

Regards

Wai Pak
Posts: 0
Joined: Sat Sep 06, 2014 11:18 pm

$(this).attr("event-item-id") no longer working after the latest upgrade

Post by Wai Pak »

I was using it in a grid. I mapped the result of a DB query to a grid. So it is very much like your example but I use it in a grid.

Within the JS on the target grid of the mapping, I have the following code:

element.attr("event-item-id", value.IDauto);
element.attr("event-item-id",value.id);

As a result, each row will have attribute of some sort of IDs.

On the click event on the grid, I have the following:
localStorage.setItem("itemId", $(this).attr("event-item-id"));
localStorage.setItem("eventDetailDBId", $(this).attr("event-item-_id"));

However, $(this).attr("event-item-id") is undefined. (noted that it was working before the upgrade)

I do see those values in the browser debugger but they are no long on the row level but on the DIV level which is not right.

Code: Select all

      ...  

             <!-- 

              mobilegridcell_20 

             -- 

                     <!-- 

                      datefield 

                     -- 
                      ...  
                     <!-- 

                      time 

                     -- 
                      ...
Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

$(this).attr("event-item-id") no longer working after the latest upgrade

Post by Yurii Orishchuk »

Hi Wai,

Unfortunatly your HTML code is not visible for us. It's better to use screen shots it this case.

But, give us your app public link and describe steps to reproduce this problem. We will take a look in your app directly.

Regards.

Wai Pak
Posts: 0
Joined: Sat Sep 06, 2014 11:18 pm

$(this).attr("event-item-id") no longer working after the latest upgrade

Post by Wai Pak »

Here is the link to the app: http://appery.io/app/mobile-frame?src...

Steps to reproduce:

  • click on "Find Events Information"

  • Enter "Ethan Pak" in the name field and click search

  • You will see a list. Click on the date/time field of any row.

  • you will be led to another page. That page ideally will list detail information about the row earlier. However, because the itemID information was not stored in localstorage, the query on the detail page was not executed.

    Let me know if you need anything else.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

$(this).attr("event-item-id") no longer working after the latest upgrade

Post by Yurii Orishchuk »

Hi Wai,

I've checked your app.

Please use following code instead of yours on table click:

pre

var parentWrapper = jQuery(this)&#46;closest('[event-item-id]');

localStorage&#46;setItem("itemId", parentWrapper&#46;attr("event-item-id"));
localStorage&#46;setItem("eventDetailDBId", parentWrapper&#46;attr("event-item-_id"));

/pre

Regards.

Wai Pak
Posts: 0
Joined: Sat Sep 06, 2014 11:18 pm

$(this).attr("event-item-id") no longer working after the latest upgrade

Post by Wai Pak »

OK! thanks. Just tested it and the new code works now.

I followed one of those tutorial to do this. So that means the tutorial materials will have to change. I was trying to find out which one it is but I cannot. Just a note for Appery.io

thanks

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

$(this).attr("event-item-id") no longer working after the latest upgrade

Post by Kateryna Grynko »

Hi Wai,

Thank you for pointing this. Please let us know if you see something to change.

Wai Pak
Posts: 0
Joined: Sat Sep 06, 2014 11:18 pm

$(this).attr("event-item-id") no longer working after the latest upgrade

Post by Wai Pak »

This is the location of the sample that I followed. The sample code worked before the last upgrade and now it does not work. The suggestion is pretty much searching for the element from the entire list of elements. While it works, it is not ideal.

http://devcenter.appery.io/documentat...

So this portion of the document should be revised.

Post Reply