Hi guys, i am having another problem this time -adding row programatically..
so i am using jquery-1.9.1.min, jQuery UI - v1.10.3 and ignite ui version 13.2.
to solve the problem i did tried to change the jquery files to older ones, or declare the iggrid component inside a table or div element.
when changing the jquery files to older ones, there was always some kind of problem, like a combo box that didnt load..
i also tried to declare the grid inside a div or table element...following this toppic:
http://es.infragistics.com/community/forums/p/76295/385579.aspx#385579
and according to this topic i should declare the iggrid component inside a table tag..
or if i want to use the div, i should change the call, acording to this link below..
http://help.infragistics.com/Help/NetAdvantage/jQuery/2012.2/CLR4.0/html/Known_Issues_and_Limitations_2012_Volume_2.html#_Ref321736823
on my view i initialy had this:
@inherits WebViewPage@using Infragistics.Web.Mvc;@{ Layout = "~/Areas/Idonic/Views/Shared/_Layout.cshtml";}
@(Html.Infragistics().Grid(Model))
and then on a button click i call this
$("hierarchicalGrid").igGridUpdating("addRow", { var1: var1, var2: var2 }); $("hierarchicalGrid").igGrid("commit");
after reading some toppics i change the view to this
@inherits WebViewPage@using Infragistics.Web.Mvc;@{Layout = "~/Areas/Idonic/Views/Shared/_Layout.cshtml";}
i also tried with the code above and remove the td and tr elements..
$("#grid1").igGrid("widget").igGridUpdating("addRow", { NomeEmpresa: sNomeDaEmpresa, Nif: sNif, Tipo: sNivelDeAcesso }); $("#grid1").igGrid("widget").igHierarchicalGrid("commit");
http://igniteui.com/grid/editing-api-events -> this example use the same js and css files dependencies and this works, i think that the problem is related to the fact that i am using ighierarchicalgrid with load on demand??
but still the error appears, what could be the issue.?
how can i add the html code as text, and not as html components?
thanks
Hello Sergio Joyce,
Thank you for posting in our forums!
As you are using our MVC Helpers, you should not be concerned with using a div vs. a table. The Helper will render the grid in a table automatically and you should not need to make an modifications to the DOM.
The following example may be more suited for demonstrating your needs since it uses the MVC Helper with the igHierarchicalGrid with Load On Demand:
http://igniteui.com/hierarchical-grid/aspnet-mvc-helper
Could you also please clarify what you mean by "adding the html code as text and not as html components" in your update?
Looking forward to hearing from you.
Hi, let me try to explained...
if i put some code in here, and that code has know html elements, when posting it transforms it to html components..
but i want to was to show the code..
example..
<table><tr><td></tr></td></table>
above i described a table, and the browser will transform this into a table...
but how can i show it as text like table tr td /td /tr /table..it is missing the <>.
i am sorry , but i am portuguese, and sometime it is difficult to explain things in the correct way..
now the main problem, i still cant add the row, i have got a hierarchical grid inside a dialogbox, and initialy the dialog is closed..
the user select the tab of User Profiles..and the page appears with the grid..
this is the page
@using LicenciamentoV4.HtmlHelpers@inherits WebViewPage<Infragistics.Web.Mvc.GridModel>@using Infragistics.Web.Mvc;
@Scripts.Render("~/bundles/Cliente")
@{ Layout = "~/Areas/Idonic/Views/Shared/_Layout.cshtml";}
<div id="StatusOperacoesBDEmpresasUtilizadores" style="display:none" > <h1><label style="color:green" id="msgStatusOperacoesBDEmpresasUtilizadores"></label></h1>
</div>
<input type="button" id="Criar_Empresa_Button" value="Criar Empresa" onclick="OpenDialogBoxAddOrEditEmpresa();" /><input type="button" id="Criar_Utilizador" value="Criar Utilizador" onclick="OpenDialogBoxAddUtilizadores();" /><input type="button" id="Undo_EmpresasUtilizadores_Button" value="Voltar Atrás" onclick="UndoDeleteEmpresasUtilizadores();" /><input type="button" id="Delete_EmpresasUtilizadores_Button" value="Eliminar" onclick="DeleteEmpresasUtilizadores();" />
@(Html.Infragistics().Grid(Model)) -->declaring the grid
@* render da dialog box do criar ou editar cliente *@@(Html .Infragistics() .Dialog() .State(DialogState.Closed) .ContentID("DialogBox_AddOrEdit_Empresa")
.HeaderText("Empresa") .Modal(true) .ShowCloseButton(true) .CloseOnEscape(true) .Width("600px") .Resizable(false) .Height("150px") .TrackFocus(false) .Render()) @* Dialgo box do editar *@<div id="DialogBox_AddOrEdit_Empresa"> @Html.Action("AddOrEdit_Empresa","EmpresasUtilizadores") </div>@* render da dialog box do criar ou editar cliente *@@(Html .Infragistics() .Dialog() .State(DialogState.Closed) .ContentID("DialogBox_Edit_Utilizador") .HeaderText("Utilizador") .Modal(true) .ShowCloseButton(true) .CloseOnEscape(true) .Width("600px") .Resizable(false) .Height("150px") .TrackFocus(false) .Render()) @* Dialgo box do adicionar utilizador *@<div id="DialogBox_Edit_Utilizador"> @Html.Action("Edit_Utilizador","EmpresasUtilizadores") </div>@(Html .Infragistics() .Dialog() .State(DialogState.Closed) .ContentID("DialogBox_Add_Utilizador") .HeaderText("Utilizador") .Modal(true) .ShowCloseButton(true) .CloseOnEscape(true) .Width("600px") .Resizable(false) .Height("150px") .TrackFocus(false) .Render()) @* Dialgo box do editar *@<div id="DialogBox_Add_Utilizador"> @Html.Action("Add_Utilizador","EmpresasUtilizadores") </div>
the grid appears fine, i want to add a main row, so i pressed the button "Criar Empresa", and that button calls the jquery function OpenDialogBoxAddOrEditEmpresa();
to open the dialog box i called
$("#DialogBox_AddOrEdit_Empresa").igDialog("open");
that dialog box contains
@using Infragistics.Web.Mvc
<div style="width:580px;"> <table style="width: 578px;"> <tr style="width: 578px;"> <td style="width:150px;" colspan="1" > <input type="button" id="DialogBox_AddOrEdit_Empresa_ButtonOk" class="button-style" value="OK" onclick="GuardarDadosEmpresa();" /> <input type="button" id="DialogBox_AddOrEdit_Empresa_ButtonCancel" class="button-style" value="Cancelar" onclick="$('#DialogBox_AddOrEdit_Empresa').igDialog('close');" /> </td> <td style="width:428px;" colspan="2" > <label id="DialogBox_AddOrEdit_Empresa_LblErros" style="color: red; display: none;"></label> <label id="DialogBox_AddOrEdit_Empresa_LblOk" style="color: green; display: none;"></label> </td> </tr> <tr style="width:578px;"> <td style="width: 50%;"> <label >Nome</label> <input id="DialogBox_AddOrEdit_Empresa_EditText_Nome" type="text" style="width: 90%;" /> </td> <td style="width: 30%;"> <label >Nif</label> <input id="DialogBox_AddOrEdit_Empresa_EditText_Nif" type="text" style="width: 90%;" />
</td> <td style="width: 20%;"> <label>Tipo de Empresa</label> @(Html.Infragistics().Combo() .ID("DialogBox_AddOrEdit_Empresa_Select_TipoAcesso") .Width("100%") .MultiSelection(ComboMultiSelection.Off) .DataSourceUrl(Url.Action("TipoAcesso-combo-data")) .ValueKey("Key") .TextKey("Value") .DataBind() .Render() ) </td> </tr> </table> </div>
then i filled the fields and press button to save...
and that function validates the data and then called addRow api,after this the error appears on the console..
i am having the same problem,this time with a igdatepicker..
what could be the problem?
so, when i first posted response above all the code apperas correcty, if after that i try to edit the post, the table code and buttons code appears as actual component and not code...
so, as usual the problem was me, after a lot of trial and error , i found out that the updating feature was only enable on child rows...
sometimes it is the simple things that are usually the problem..
but as one problem is solve (i hope), another appears, after adding the row, how can i refresh the grid..
i had tried this :
//$("#hierarchicalGridEmpresasUtilizadores").igHierarchicalGrid("option", "dataSource", "/Area1/EmpresasUtilizadores/GetListaEmpresas"); //$("#hierarchicalGridEmpresasUtilizadores").igHierarchicalGrid("dataBind");
//$("#hierarchicalGridEmpresasUtilizadores").igHierarchicalGrid("option", "dataSource", "/Area1/EmpresasUtilizadores/Index");//$("#hierarchicalGridEmpresasUtilizadores").igHierarchicalGrid("dataBind");
//$("#hierarchicalGridEmpresasUtilizadores").igHierarchicalGrid("option", "dataSource", "/Area1/EmpresasUtilizadores/dataParent"); -> dataparent call this method//$("#hierarchicalGridEmpresasUtilizadores").igHierarchicalGrid("dataBind");
//$("#hierarchicalGridEmpresasUtilizadores").igHierarchicalGrid("dataBind");
what it does is that the grid data disappears from the grid..
thanks..
Hi Sergio Joyce,
I am glad to hear you resolved the previous issue.
In order to refresh the grid, calling $("#hierarchicalGridEmpresasUtilizadores").igHierarchicalGrid("dataBind"); should be enough to request the data from the server. How are you setting your igHierarchicalGrid's dataSource? Are you using a DataSourceUrl to call an Action in your controller? If so, does the browser make a request to the server and does it return any data? You can check this through your browser's network traffic in the Dev tools.
Thank you for the clarification on your question regarding displaying HTML. I did not realize you were referring to the forums earlier.
We do provide code tags in the forum posts that can be used when posting code. This may help prevent the HTML from being rendered. You can see an example of this below.
Typing this:
[code] <div> <p>Test</p> </div>[/code]
Displays as:
<div> <p>Test</p> </div>
thanks for the explanation about the code tag..
this is my function, that is called when i press save button on igdialog.
function GuardarDadosEmpresa() {$("#DialogBox_AddOrEdit_Empresa").igDialog("close");
//close dialog box var sNomeDaEmpresa = $("#DialogBox_AddOrEdit_Empresa_EditText_Nome").val(); var sNif = $("#DialogBox_AddOrEdit_Empresa_EditText_Nif").val(); var sNivel11DeAcesso = $("#DialogBox_AddOrEdit_Empresa_Select_TipoAcesso").igCombo("activeIndex");
//get values of textbox
$("#hierarchicalGridEmpresasUtilizadores").igGridPaging("pageIndex", 1); if (sNomeDaEmpresa == "" || sNif == "" || sNivelDeAcesso == -1) {
//validation, if one of the fields is empty alert("Faltam introduzir alguns dados relativamente a empresa"); } else { if (_iAddOrEdit == 1) {
//_iAddOrEdit, is a variable that tells me if i am adding or editing a company. $("#hierarchicalGridEmpresasUtilizadores").igGridUpdating("addRow", { NomeEmpresa: sNomeDaEmpresa, Nif: sNif, Tipo: sNivelDeAcesso }); $("#hierarchicalGridEmpresasUtilizadores").igHierarchicalGrid("commit"); } else { $("#hierarchicalGridEmpresasUtilizadores").igGridUpdating("updateRow", _iIDRowSelecionada, { NomeEmpresa: sNomeDaEmpresa, Nif: sNif, Tipo: sNivelDeAcesso }); $("#hierarchicalGridEmpresasUtilizadores").igHierarchicalGrid("commit"); } $("#hierarchicalGridEmpresasUtilizadores").igHierarchicalGrid("saveChanges"); alert("before databind"); $("#hierarchicalGridEmpresasUtilizadores").igGrid("dataBind"); alert("after databind");
$("#hierarchicalGridEmpresasUtilizadores").igGridUpdating("option", "saveChangesSuccessHandler", function (data) { var ResultOfSaveChangesOfEmpresa = data.Success; CheckResultOfSaveChangesGrid_Utilizadores_By_Empresa(ResultOfSaveChangesOfEmpresa) }); //the function above is to display a message,to tell if error occurred or it save correctly.. }}
so i run it on firefox and using the firebug i see
{"Records":[{"IDEmpresa":1,"NomeEmpresa":"IdonicTeste","Nif":"123","Tipo":"Idonic","Obs":null,"NomeIDU":"IdonicAdmin","EmpresaIDU":"IdonicTeste","DataAlteracao":"21/04/2014","Users":{"Records":[],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":3600000}}},{"IDEmpresa":2,"NomeEmpresa":"teste1","Nif":"teste","Tipo":"Distribuidor","Obs":null,"NomeIDU":"emp1","EmpresaIDU":"IdonicTeste","DataAlteracao":"19/04/2014","Users":{"Records":[],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":3600000}}},{"IDEmpresa":11,"NomeEmpresa":"sasa","Nif":"sasas","Tipo":"Idonic","Obs":null,"NomeIDU":"IdonicAdmin","EmpresaIDU":"IdonicTeste","DataAlteracao":"08/05/2014","Users":{"Records":[],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":3600000}}},{"IDEmpresa":12,"NomeEmpresa":"sdsdsdsd","Nif":"sdsdsdsd","Tipo":"Idonic","Obs":null,"NomeIDU":"IdonicAdmin","EmpresaIDU":"IdonicTeste","DataAlteracao":"08/05/2014","Users":{"Records":[],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":3600000}}},{"IDEmpresa":13,"NomeEmpresa":"dsds","Nif":"dsds","Tipo":"Idonic","Obs":null,"NomeIDU":"IdonicAdmin","EmpresaIDU":"IdonicTeste","DataAlteracao":"08/05/2014","Users":{"Records":[],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":3600000}}},{"IDEmpresa":14,"NomeEmpresa":"a","Nif":"a","Tipo":"Idonic","Obs":null,"NomeIDU":"IdonicAdmin","EmpresaIDU":"IdonicTeste","DataAlteracao":"08/05/2014","Users":{"Records":[],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":3600000}}}],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":3600000}}
{"Records":[{"IDEmpresa":1,"NomeEmpresa":"IdonicTeste","Nif":"123","Tipo":"Idonic","Obs":null,"NomeIDU"
:"IdonicAdmin","EmpresaIDU":"IdonicTeste","DataAlteracao":"21/04/2014","Users":{"Records":[],"TotalRecordsCount"
:0,"Metadata":{"timezoneOffset":3600000}}},{"IDEmpresa":2,"NomeEmpresa":"teste1","Nif":"teste","Tipo"
:"Distribuidor","Obs":null,"NomeIDU":"emp1","EmpresaIDU":"IdonicTeste","DataAlteracao":"19/04/2014","Users"
:{"Records":[],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":3600000}}},{"IDEmpresa":11,"NomeEmpresa"
:"sasa","Nif":"sasas","Tipo":"Idonic","Obs":null,"NomeIDU":"IdonicAdmin","EmpresaIDU":"IdonicTeste","DataAlteracao"
:"08/05/2014","Users":{"Records":[],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":3600000}}},{"IDEmpresa"
:12,"NomeEmpresa":"sdsdsdsd","Nif":"sdsdsdsd","Tipo":"Idonic","Obs":null,"NomeIDU":"IdonicAdmin","EmpresaIDU"
:"IdonicTeste","DataAlteracao":"08/05/2014","Users":{"Records":[],"TotalRecordsCount":0,"Metadata":{"timezoneOffset"
:3600000}}},{"IDEmpresa":13,"NomeEmpresa":"dsds","Nif":"dsds","Tipo":"Idonic","Obs":null,"NomeIDU":"IdonicAdmin"
,"EmpresaIDU":"IdonicTeste","DataAlteracao":"08/05/2014","Users":{"Records":[],"TotalRecordsCount":0
,"Metadata":{"timezoneOffset":3600000}}},{"IDEmpresa":14,"NomeEmpresa":"a","Nif":"a","Tipo":"Idonic"
,"Obs":null,"NomeIDU":"IdonicAdmin","EmpresaIDU":"IdonicTeste","DataAlteracao":"08/05/2014","Users":
{"Records":[],"TotalRecordsCount":0,"Metadata":{"timezoneOffset":3600000}}}],"TotalRecordsCount":0,"Metadata"
:{"timezoneOffset":3600000}}
but the grid is empty...no lines appear..
I am glad to hear that you were able to find a solution for this. You should not have to add and hide a multi-column header to the parent grid to enable sorting. So, I have created a support case for you with an ID of CAS-136422-B7N9H4 for this issue. The matter has been determined to be a development issue and has been logged in our tracking system with ID: 171779.
I will leave this case open and update you with any new information. You can view the status of the development issue connected to this case by going to the “Account” tab on our website, selecting "My Support Activity" and then this support case will be listed there. Then, you may select the "Development Issues" tab to view details of this development issue.
Please let me know if you have any questions.
yes, i was unable to use the sortable if child grid has multicolumn header and main grid doesnt have..
the way that i did to resolve this was to add a multicolumn header on main grid then hide it.
I am able to reproduce this issue where you are unable to use Sorting on the parent grid while a child grid has MultiColumnHeaders.
I will need a little more time to research this. I will have another update on my findings for you tomorrow.
hi, i did some testing, and the sorting features are enable in both levels..
the way i did was to add a multi column header in the main grid and hide it..
I am glad to hear you are able to bind the grid.
It does sound strange that the multicolumn headers affects that. I would need some more time to look into this issue.
Features need to be enabled per level in the igHierarchcialGrid. Do you have the sorting feature enabled in the main grid or just in the child grid? This could explain why you cannot sort in the main grid.
If you have any further questions or concerns with this, please let me know.