Unable to execute if conditions using REST

Unable to execute if conditions using REST

beginner_2018beginner_2018 Posts: 46Questions: 19Answers: 0
edited May 17 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: 47,459Questions: 1Answers: 6,739 Site admin

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

    Allan

  • colincolin Posts: 1,685Questions: 0Answers: 306

    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

Sign In or Register to comment.