iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi,
How do you prevent users from deleting specific items or an item that has a NotDeletable column/field name? Please provide a sample code snippet for iOS and Android only, since for WinPhone, WinRT... this should be straightforward. So yeah, samples for iOS and Android... please?
We understand for iOS that this might be possible by binding the CanDelete on cell item level, which is bound to a row. But not quite sure about that for iOS though. On Android, hmmm... this one might be tricky since it does not have customization for edit actions on cell level, but I could be wrong. We assume that's how it is for Android since holding/pressing on an item long enough will popup a new check list view where you can select the items that you can delete. But how do you disable checking an item that should not be deleted? Meaning you should not be able to check/select an item from the list if it's tagged as NotDeletable == true.
Again, samples for both iOS and Android would be very much helpful. Thanks!
Overriding CanExecuteDelete can be used in order to prevent delete on item from DataListViewModelBase.
I use MyInventoryWebAPI Crosslight sample and apply this rule: prevent delete on item(s) that have been sold. Note that the Item has a Sold column/field name.
Override CanExecuteDelete and insert following code:
protected override bool CanExecuteDelete(object parameter) { // only return true if item is not sold // prevent delete on item(s) that has/have been sold // on multiple selection scenario, if any item from // the selected item is sold, delete will be disabled if (parameter is Item) { return !(parameter as Item).Sold; } else if (parameter is IEnumerable<Item> && ((IEnumerable<Item>)parameter).Count() > 0) return !((IEnumerable<Item>)parameter).Any(p => p.Sold == true); return false; }
I uploaded the modified version of MyInventoryWebAPI sample at OneDrive: here, as reference. Hope this helps.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname