locked
Display double as percentage HTML client RRS feed

  • Question

  • I am brand new to the HTML client, I was wondering if someone could help with the following.  I simply want to show the doubles in the html screen as a percentage.  From what I've read, I'd use postrender, but I've been unsuccessful.  I am unable to change the field type as its a foreign data source and the format pattern seems to be unrelated to HTML display?

    My entity is named workrequest, the field name is Complete.

    Wednesday, December 16, 2015 6:13 PM

Answers

  • You could try something like this in the post_render function:

    contentItem.dataBind("value", function (value) {
        if (value) {
            $(element).text((value * 100).toFixed(1) + '%');
        }
    }); 


    • Edited by Hessc Monday, December 21, 2015 5:46 PM
    • Proposed as answer by Hessc Monday, December 21, 2015 5:47 PM
    • Marked as answer by Angie Xu Thursday, December 24, 2015 11:41 AM
    Thursday, December 17, 2015 2:21 AM

All replies

  • You could try something like this in the post_render function:

    contentItem.dataBind("value", function (value) {
        if (value) {
            $(element).text((value * 100).toFixed(1) + '%');
        }
    }); 


    • Edited by Hessc Monday, December 21, 2015 5:46 PM
    • Proposed as answer by Hessc Monday, December 21, 2015 5:47 PM
    • Marked as answer by Angie Xu Thursday, December 24, 2015 11:41 AM
    Thursday, December 17, 2015 2:21 AM
  • Thank you, going to try it :)
    Monday, December 21, 2015 4:18 PM
  • Perfect, I put quotations around the percent... but its exactly what I needed!
    Monday, December 21, 2015 4:19 PM
  • Eric,

    That is great that it is working for you.  I edited my answer to include the quotes.  If you don't mind, please mark as the answer.

    Thanks.

    Monday, December 21, 2015 5:47 PM