Richard Norte
Posts: 0
Joined: Fri Aug 17, 2012 6:34 pm

Display an image icon instead of the returned value from the database collection for a given field.

I have a field in my database collection that can be either true or false. On my UI instead of displaying this field as its actual value.. IE: true or false. I would like to instead display an image icon for the corresponding true or false value. IE: if the value is true then display a "check" icon image.

Now, this has to happen for every record returned from the database collection. So I'm not sure how the UI will iterate down through the records to display a "check" icon image or not.

My guess is I could run a custom javascript on the value I am testing. In my case it is the "Reported" field.

Is there a simpler way to accomplish this? Image

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Display an image icon instead of the returned value from the database collection for a given field.

You would need to run this code in image mapping, this way it would be applied to each row in your collection. You do have some typos in the code.

code
var isReported = Tiggr ('Reported').Text;
/code

should be:
code
var isReported = Tiggr ('Reported').text();
/code

Tiggr(id) or Tiggzi(id) returns a jQuery object so you need to use API that jQuery, jQuery Mobile supports.

Richard Norte
Posts: 0
Joined: Fri Aug 17, 2012 6:34 pm

Display an image icon instead of the returned value from the database collection for a given field.

Please see the screenshot below. Is this what you mean? I know you mentioned I need to use an API that jQuery Mobile supports but I am not sure how to apply that part of the solution. May I have some more guidance please. :) Prehap's we are getting close. Thank you so much for the learning points I really appreicate it Max. You are awesome!

Image

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Display an image icon instead of the returned value from the database collection for a given field.

Are you able to share the API you are using or paste a sample JSON reply?

Richard Norte
Posts: 0
Joined: Fri Aug 17, 2012 6:34 pm

Display an image icon instead of the returned value from the database collection for a given field.

Sorry but this is new stuff for me. I did not include API into my solution. Do I need to go to jquery mobile and get their API files and upload into my track hours project under any special folders? Then, do some type of reference to them in my javascript? Please see my attached screenshots. Image Image

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Display an image icon instead of the returned value from the database collection for a given field.

In the first image, you get Response Mapping and response parameters defined. Those should be coming form a REST service. Which one are you using?

Richard Norte
Posts: 0
Joined: Fri Aug 17, 2012 6:34 pm

Display an image icon instead of the returned value from the database collection for a given field.

I am using my get_Hours reset service. Please see screenshot:

Image

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Display an image icon instead of the returned value from the database collection for a given field.

Could you post a sample JSON response from that service?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Display an image icon instead of the returned value from the database collection for a given field.

Sorry, could you paste it as text? I'd like to run it.

Return to “Issues”