What is the working, not deprecated alternative for below code?

What is the working, not deprecated alternative for below code?

function ClearList(item) {

var Ritems = item.getItems();

for (var j = 0; j < Ritems.getLength(); j++) {

item.removeItem(Ritems.getAt(j));

}

}

My guess was:

function ClearList(item) {

var Ritems = item.getAllItems();

for (var j = 1; j <= Ritems.length; j++) {

item.removeItem(Ritems[j]);

}

}

But the “removeItem” throws an error 🙁

]]>

4 Commentsto What is the working, not deprecated alternative for below code?

  1. Anonymous says:

    < ![CDATA[

    I guess the error is OutOfBoundsException ? It should start at 0 and end at length-1 as with the Array object.

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Well…. Today it is… After a phone restart.


    There’s some kind of version caching going on.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Btw..


    About depricaton:



    getItems –> getAllItems


    but


    getAllBinding –> getBindings

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Yes I know, but I couldn’t rename methods to make them coherent as it would have break compatibility with existing scripts 🙁

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *