This question is locked. New answers and comments are not allowed.
Hello...
I'm using your new component combobox in a grid. For that, I've created an "EditorTemplate" for the field I want the combobox to be displayed... In that template, I need to "inject" the current Id and Label of the combobox, because the combo items are loaded with ajax, and at render time that list is void. But I'm unable to access the row's Json object ...
When I need to access the Json data of a row where the user has clicked or something like that I use this:
and it works, so I tried to do it this way for the edit template like this:
When I click the grid's edit button, the template gets rendered and the javascript code executed, but the alert returns 'undefined', meaning that dataItem function returned null...
I've debugged and I see the "data" property of grid.data('tGrid') and all the Json objects are there (in an array)... why is the 'dataItem()' function returning undefined?
Could this have something to do with the row being in edit mode? Is the only thing I can think of... what would be then the correct way to obtain the json object for that row in edit mode??
Thanks!!
I'm using your new component combobox in a grid. For that, I've created an "EditorTemplate" for the field I want the combobox to be displayed... In that template, I need to "inject" the current Id and Label of the combobox, because the combo items are loaded with ajax, and at render time that list is void. But I'm unable to access the row's Json object ...
When I need to access the Json data of a row where the user has clicked or something like that I use this:
var jsonObj = $('#myGrid').data('tGrid').dataItem($(e.target).closest('tr'));and it works, so I tried to do it this way for the edit template like this:
<%=Html.Telerik().ComboBoxFor(o => o.Id) .DataBinding(db => db.Ajax().Select("_obtenerComboEmpresas","GrupoEmpresa")) .Filterable(ft => ft.FilterMode(AutoCompleteFilterMode.StartsWith)) .AutoFill(true) %> <script type="text/javascript"> $(document).ready(function(e) { var combo = $('#Empresa_Id'); // this would be the Id for the ComboboxFor var grid = combo.closest('div.t-grid'); var jsonObj = grid.data('tGrid').dataItem(combo.closest('tr')); alert(jsonObj); } </script>When I click the grid's edit button, the template gets rendered and the javascript code executed, but the alert returns 'undefined', meaning that dataItem function returned null...
I've debugged and I see the "data" property of grid.data('tGrid') and all the Json objects are there (in an array)... why is the 'dataItem()' function returning undefined?
Could this have something to do with the row being in edit mode? Is the only thing I can think of... what would be then the correct way to obtain the json object for that row in edit mode??
Thanks!!