Hi,
I'm using igCombo in an MVC Razor view, configured with remote filtering and load on demand, bound to a remote datasource.
The remote is backed by a database, where I'm using logical deletion, i.e. I have a boolean column named IsDeleted and set to false by default, and when deleting an element, I'm not actually deleting it from the table, I'm just setting this flag to true. This way I can keep the references to it from other entities. So, when I delete a row, which is set as an option somewhere, the reference is kept, the user can keep the old, deleted option, but if he changed it to another option, he can't change back to deleted ones.
In pure HTML I can do the following:
<select> <option value="volvo" disabled selected>Volvo</option> <option value="saab">Saab</option> <option value="vw">VW</option> <option value="audi">Audi</option></select>
In this example, the actual value of this dropdown is Volvo, but eventually it got deleted. With this code, the user can keep the selected Volvo, or can change to the other 3 options, but once changed, he can not change back to Volvo.
I'd like to achieve the same behavior using the igCombo control. The datasource currently only returns non-deleted elements, but I can change this behavior if needed.
This question may be related to my other question: http://ko.infragistics.com/community/forums/p/105234/497332.aspx
i'm not sure if this issue needs to be handled separately, therefore I'm asking it in a different thread. Please feel free to close this if the two are related.
regards,
Peter
Hi Peter,
Could please clear the following detail: when some item is deleted, it should be removed from the combo (when it becomes inactive) or it should be kept in the combo but marked somehow?
Petko,
Both options seems good for me. Could you please describe both of them?
thanks,
As you probably know, igCombo is multi functional and highly customizable. It allows to implement almost every reasonable scenario.
In your both options similar approaches can be used. I prepared a project that demonstrates both of them. (A new ASP.NET MVC project without Bin Folder) Please find removing items approach on page About, and marking deleted items on Contacts page.
The general idea behind them is:
- keep collections with deleted cars;
- on Delete button click - through ajax update the collection and on its success callback - update combo (or some hidden filed, so later on other combo event, you will be able to update the widget).
- Handle some appropriate client events: selectionChanged, dropDownOpening or/and selectionChanging, where the other logic should be implemented. Like: disabling the selection of deleted items or marking new deleted items (e.g.: red color);
Hope the sample is enough descriptive!
Please let me know whether you need any further assistance!