Hi,
Is there a way to add ID attribute to a combo editor inside igGrid ? I'm using MVC helper to set the combo editor but there's no property that does that I don't think.
if you would like to locate a specific combo in a templated row, i suggest ti get the row element by relying on its data-id attribute (or just the index), which the grid renders, then locating the combo as a child of that row element, using some of its CSS classes as a selector.
example:
var row = $("#grid1").igGrid("rowAt", <index>);
var combo = $(row).find(".ui-igcombo");
Or row by primary key:
var row = $("#grid1").find("tr[data-id='<your ID>']");
Hope it helps. Thanks,
Angel
If I try to do:
$(document).find(".ui-igcombo")
I am the unable to take datasource and to query it...
Any ideas?
Flavio M.
I re-open this question because I am in trouble with an igCombo in a grid.The problem is simple. I created a GridModel by controller side, adding an igCombo with the following code, where gm is my GridModel and updating is my GridUpdating:
GridColumn colCustomer = new GridColumn(); colCustomer .Key = "CustomerId"; colCustomer .FormatterFunction = "mapCustomer"; colCustomer .HeaderText = "Customer"; gm.Columns.Add(colCustomer );
ColumnUpdatingSetting updateSettings = new ColumnUpdatingSetting(); updateSettings .ColumnKey = "CustomerId"; updateSettings .EditorType = ColumnEditorType.Combo; ColumnUpdatingComboEditorOptions updatingComboEditorOptions = new ColumnUpdatingComboEditorOptions(); updatingComboEditorOptions.DataSource = customers.AsQueryable(); updatingComboEditorOptions.DropDownOnFocus = true; updatingComboEditorOptions.ShowDropDownButton = false; updatingComboEditorOptions.ValueKey = "CustomerId"; updatingComboEditorOptions.TextKey = "CustomerName"; updatingComboEditorOptions.FilteringType = ComboFilteringType.Local; updateSettings .ComboEditorOptions = updatingComboEditorOptions; updateSettings .Required = true; updating.ColumnSettings.Add(updateSettings);
Situation:Grid is initially empty (because I have no items). I click on AddRow and I select a value from the combo list. I click on Done and now mapCustomer formatter function is called...Here I would like to say something like: function mapCustomer(id) { var data = // combo datasource related to id... return data; }
But I am not able to find the way to access datasource from my combo for 2 reasons:
This is why I can't use the method you suggested...or maybe is there one very similar to select that datasource???
Thanks
Thanks, that's what I am currently doing right now.