how to remove selection parcels & error on duplicate selection parcels to current datagrid

2313
3
10-09-2015 08:03 AM
jamesa
by
New Contributor III

Hello all,

I found this thread - Add more selection parcels to current datagrid  able to select additional parcel(s) to current datagrid but is there possible to click a button to remove current any highlighted parcels on a map? Besides that, I found an error message. If the parcels have been selected and you accidentally reselect it again then you will get an error message. So can you ignore it or prevent the error message so the datagrid table will still got the same results from your early search instead of showing error message on datagrid?

Ken also provided code in fiddle:

Edit fiddle - JSFiddle

Thank you.

J

0 Kudos
3 Replies
KenBuja
MVP Esteemed Contributor

It was an easy fix for that error. Edit fiddle - JSFiddle

The code added the newly selected parcel into an array. I just added an if statement to check whether the new parcels were already in that array.

arrayUtils.forEach(newparcelItems, function (item) {
    if (parcelItems.indexOf(item) !== 0){
        parcelItems.push(item);
    }
});
0 Kudos
jamesa
by
New Contributor III

I try update the code but still got error message if reselect the same parcel that already showed on the datagrid.

errorselect.gif

Thank you Ken.

0 Kudos
jamesa
by
New Contributor III

Can someone give me some ideas how to do this? At least get rid of the error message.  Thank you.

0 Kudos