It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

AUI: when JSON contains 0 (zero) as integer it's not rendered in RestfullTable

When my back-end rest service is providing below Json, RestfullTable is not rendering zero values, just empty cells.

[ {
  "priority" : "CRITICAL",
  "open" : 2,
  "close" : 3,
  "resolve" : 1
}, {
  "priority" : "MAJOR",
  "open" : 1,
  "close" : 1,
  "resolve" : 0
}, {
  "priority" : "MINOR",
  "open" : 2,
  "close" : 0,
  "resolve" : 1
} ]

However, when I serialize it as strings like below it would be displayed properly.

[
    {
        "priority": "CRITICAL",
        "open": "2",
        "close": "3",
        "resolve": "1",
        "total": "6"
    },
    {
        "priority": "MAJOR",
        "open": "1",
        "close": "1",
        "resolve": "0",
        "total": "2"
    },
    {
        "priority": "MINOR",
        "open": "2",
        "close": "0",
        "resolve": "1",
        "total": "3"
    }
]

My JavaScript code is below:

AJS.$(document).ready(function(){
        metricTable = new AJS.RestfulTable({
            autoFocus: true,
            el: jQuery("#issues-status-table"),
            allowReorder: false,
            allowEdit: false,
            allowCreate: false,
            allowDelete: false,
            noEntriesMsg: "nothing to show",
            resources: {
                all: "http://amdc2798:5050/all-issues"
            },
            columns: [
                {
                    id: "priority",
                    header: "Priority"
                }, {
                    id: "open",
                    header: "Open"
                }, {
                    id: "close",
                    header: "Close"
                }, {
                    id: "resolve",
                    header: "Resolve"
                }, {
                    id: "total",
                    header: "Total"
                }             
            ]
        });
});

There is any flag I can set? Is it intentional behavior or it's a bug in AUI?

My model has int values not strings, serializing values to strings, just because some JS lib is misbehaving seams to be quite awkward.

1 answer

Some values seems to be treated to not be rendered by RESTful table. Boolean "false" seems to be another example.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted 5 hours ago in Off-topic

Miscellaneous Monday - Where it all started.

Happy Monday everyone! If you're anything like me, you tend to think a lot about what the future looks like. What are my kids up to in 15 years? Have we solved for climate change? How could TVs poss...

18 views 1 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you