What I'd like to do:
I have a grid with igCombo as editor. Let's say column A and B have igCombo as editor. I need to remove some data from igCombo in Column B when user changed combo selection in column A.
So I need to change options displayed by igCombo in column B every time user changes selection in column A.
What I've tried so far:
- I've been able to grab the dataSource of combo in column B, delete from the dataView property and it seems to work, but the size of the dropdown does not change. So the drop down has some empty rows.
Is there a better way to do this ? how do I resize the drop down height on the fly ?
Thanks
I think I'll do that global help method, that makes sense to me.
Viktor, I really hate doing this but I'm kind of pressed in time and I just ran into another problem.. I've made another post below:
http://es.infragistics.com/community/forums/t/73218.aspx
Please take a look when you have time.. it's basically the igCombo is displaying the Value instead of Text when edit is done and also accessing the entity that is passed from .NET
Appreciate the help,
Jeffrey
Hi Jeffrey,
I am glad that you figure out my codes.
Global reference to igGridUpdating is ok, though, that may have problems if you have few grids. You may create a global help method likefunction _getUpdating(gridID) { return $('#' + gridID).data('igGridUpdating');}
Something like// note: that will return null before start editingvar editor = $('#' + gridID).igGridUpdating('editorForKey', 'MyColumnKey');or$('#' + gridID).igGridUpdating('startAddRowEdit');should work as well.
I think that the best, is to take that reference from ui.owner events of updating.
It's working !! Thanks for the explanation
Wow access to igGridUpdating is so powerful. I'm thinking about putting global reference to that object itself since I'm doing a lot of tweaks, updates, getting controls of different columns, let me know if you don't think this is a good idea.
Thanks Viktor !! Really appreciate your help
The ui.owner in updating events is igGridUpdating. In my codes it is used to get reference to editor by getEditorForKey. While processing events of igCombo, the reference to igGridUpdating is not available, therefore _my_updating is used. That variable is set before start editing, before igCombo may fire its events. Global variable can be used as well.
The fixSlaveCombo is called on start editing. At this point it is used to initialize slave combo from current selection in main combo. It also used to initialize selection in slave combo with new dataSource defined by main combo.The fixSlaveCombo is also called when selection in main combo is changed. At this point the dataSource of slave combo is adjusted to selection in main combo.
It is possible to remove first 2 parameters from fixSlaveCombo and use something likevar updating = $(idOfGrid).data('igGridUpdating');var mainCombo = updating.editorForKey('KeyOfMainColumn');var slaveCombo = updating.editorForKey('KeyOfSlaveColumn');
It is also possible to process editCellStarted events and create global references to editors. Likevar mainCombo, slaveCombo;...editCellStarted: function (evt, ui) { if (ui.columnKey === "mainColumn") mainCombo = ui.editor; if (ui.columnKey === "slaveColumn") slaveCombo = ui.editor; fixSlaveCombo(...); }
Thanks for the reply Viktor.
I haven't fully implemented your code to work with mine, but it seems to be working so far. Would you explain your code a little bit for me ? I might be able to use these techniques in the future.
the ui.owner on selectionChanged is the combo control right ? what about ui.owner on editCellStarted ? Why do you need to attach that to _my_updating property of the main combo ?
Before trying your solution, I tried grabbing the editor control using something like this code below without any success.