Page 1 of 3
Display an image icon instead of the returned value from the database collection for a given field.
Posted: Thu Oct 11, 2012 3:36 pm
by Richard Norte
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?
Display an image icon instead of the returned value from the database collection for a given field.
Posted: Thu Oct 11, 2012 5:10 pm
by maxkatz
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.
Display an image icon instead of the returned value from the database collection for a given field.
Posted: Thu Oct 11, 2012 7:47 pm
by Richard Norte
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!
Display an image icon instead of the returned value from the database collection for a given field.
Posted: Thu Oct 11, 2012 9:05 pm
by maxkatz
Are you able to share the API you are using or paste a sample JSON reply?
Display an image icon instead of the returned value from the database collection for a given field.
Posted: Fri Oct 12, 2012 6:13 pm
by Richard Norte
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.
Display an image icon instead of the returned value from the database collection for a given field.
Posted: Fri Oct 12, 2012 11:19 pm
by maxkatz
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?
Display an image icon instead of the returned value from the database collection for a given field.
Posted: Sun Oct 14, 2012 12:20 am
by Richard Norte
I am using my get_Hours reset service. Please see screenshot:
Display an image icon instead of the returned value from the database collection for a given field.
Posted: Sun Oct 14, 2012 11:38 pm
by maxkatz
Could you post a sample JSON response from that service?
Display an image icon instead of the returned value from the database collection for a given field.
Posted: Mon Oct 15, 2012 5:26 pm
by Richard Norte
Sure thing. Here you go:
Display an image icon instead of the returned value from the database collection for a given field.
Posted: Tue Oct 16, 2012 2:39 am
by maxkatz
Sorry, could you paste it as text? I'd like to run it.