Unable to execute if conditions using REST

Unable to execute if conditions using REST

beginner_2018beginner_2018 Posts: 46Questions: 19Answers: 0
edited May 2018 in Free community support

Dear All,

I am accessing the data from SharePoint list items , And I had written the if condition to set the value if it is null.
But I continuously get the error.

Can any one please do let me know what's wrong in it

{
            "mData": "StagePlan",
            render: function (data, type, row, meta ) {
                if(data=="[object Object]" || data=="null")
                {
                return "No Data ";
                }
                else
                {
                return data;
                }
             }
           }

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    We'd really need a link to a page showing the issue so we can help to debug it.

    Allan

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @beginner_2018 ,

    data=="[object Object]" looks odd, and I'm not sure it's doing what you want it to do, but I'd be surprised if that's causing the error.

    However, if you comment out all that columns.render code and just have return data, do you still see the error?

    Cheers,

    Colin

This discussion has been closed.