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.?
hi, so after doing some search i did manage to refresh de grid by calling databind..
and i also found out that the when i tried to refresh the grid there was an error saying ths is unvalid...
so the first thing i do was remove all the features on the grid..then add one by one and try to figure where the problem was launched..
the grid without the features was refresh,after that i add the fetures one by one, with every features and the grid refreshed.
now here comes the problem (a odd one) that i foud out, i have got a hierarchical grid, and on the subgrid i have got multicolumn headers,but the main grid doesnt have multicolumns header.
in this case the refresh does not work, the error is launched, i also noticed that i cant sort the fields in the main grid, but in the subrid i can do the sorting.
now if i add multicolumns header to the maing grid, and in this case i have got multicolumn headers in both main grid and child grid..the databind run great and i can do all the features..
Strange, isnt it..
Hi Sergio Joyce,
Please see my attached sample that demonstrates adding a row to the igHierarchicalGrid using your code. My grid updates itself after calling SaveChanges without needing to call dataBind on it.
I followed the steps you suggested and was unable to reproduce the behavior you're describing. I set up a HierarchicalGrid and a button using a modified version of the code you provided. When I press the button, a row gets added and the grid displays all the rows.
I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.
If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the library versions we are using. My test was performed using version 13.2.20132.2212 in IgniteUI 2013 Volume 2.
If the project does show the product feature working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.
Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Please let me know if I can provide any further assistance.
Thank you for the information. I will need a little more time to look into this issue.
I will have another update with more information or questions for you tomorrow.
i have done more test, the problem still continues, one thing that i notice was that the data that was recovery didnt have the last register that was added..
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..
thanks