Hi,
There is a requirement, where I should add all the selected items from an asp:datagrid to infragistics webdatagrid without hitting the database.
I had used grid.get_rows().add(new_row) to add all the selected items to infragistics webdatagrid.
However I see that only the first selected item is added while the other selected items are not added.
Your help is very much appreciated.
Please find the code snippet.
function CopyPrev() {
var tbl = document.getElementById("dgPrev"), chkd, isbn, title, prn, subacct, type;
for (var i = 1; i < tbl.rows.length; i++) {
chkd = tbl.rows[i].cells[0].innerHTML;
if (("" + window.event) == "undefined") {
type = "FF";
if (tbl.rows[i].cells[0].childNodes[1].childNodes[0].checked) {
chkd = "CHECKED";
}
else {
chkd = "";
type = "IE";
if (chkd.search("CHECKED") != -1) {
if (type == "IE") {
isbn = ExtractString(tbl.rows[i].cells[1].innerText);
isbn = ExtractString(tbl.rows[i].cells[1].childNodes[1].innerHTML);
if (isbn.length > 8) {
title = ExtractString(tbl.rows[i].cells[2].innerText);
prn = ExtractString(tbl.rows[i].cells[3].innerText);
subacct = ExtractString(tbl.rows[i].cells[4].innerText);
title = ExtractString(tbl.rows[i].cells[2].childNodes[1].innerHTML);
prn = ExtractString(tbl.rows[i].cells[3].childNodes[1].innerHTML);
subacct = ExtractString(tbl.rows[i].cells[4].childNodes[1].innerHTML);
if (ISBNDupeSearch(isbn, subacct, prn) == false) {
var gGrid = $IG.WebDataGrid.find('uwgTime');
var new_row = [gGrid.get_columns().get_length() - 4];
new_row[0] = isbn
new_row[1] = title
new_row[2] = prn
new_row[3] = subacct
for (var j = 4; j < gGrid.get_columns().get_length() - 4; j++) {
new_row[j] = 0;
gGrid.get_rows().add(new_row);
The dgPrev is the asp:Datagrid.
uwgTime is infragistics webdatagrid
The first loop is to select all the chosen items from the table and add it to infragistics webdatagrid.
The seccond loop is to add zeros to empty columns in the array of new_row.
Please let me know if any further details are required
Hello Niranjani,
Thank you for contacting Infragistics!
To achieve this behavior you would want to use the batch updating feature of the editing core:
http://help.infragistics.com/doc/ASPNET/2014.1/CLR4.0/?page=WebDataGrid_Batch_Updating_Enabling.html
Once you have done this you should be able to add multiple rows at a time without causing a postback until you are ready to save the changes.
Thanks Mike, that worked.
However the InitGrid event which is given in the ClientEventsInitialize of Webdatagrid doesn't fire after I add rows using gGrid.get_rows().add(new_rows).
Earlier before enabling batch update this event was getting fired.
I would like to know how to call the InitGrid event after adding multiple rows.
Please note that I do not save the new rows added before I hit a button and this is to be handled in client side.
Plaese let me know if I can handle adding multiple rows by enabling Batch Update and after which hit the function InitGrid which is given in the ClientEventsInitialize of Webdatagrid before postback in clientside.
Your help is much appreciated.
Thank you for the update. The reason the InitGrid isn’t firing after every newly added row any more is that with batch updating enabled it do not postback after each new row added or update made. So the page doesn’t refresh so the event isn’t expected to fire until you cause another postback. If you need an event that fires after adding of a row I recommend you use the RowAdding or RowAdded event on the client side:
http://help.infragistics.com/doc/ASPNET/2014.2/CLR4.0/?page=Infragistics4.Web.v14.2~Infragistics.Web.UI.GridControls.EditingClientEvents~RowAdded.html
http://help.infragistics.com/doc/ASPNET/2014.2/CLR4.0/?page=Infragistics4.Web.v14.2~Infragistics.Web.UI.GridControls.EditingClientEvents~RowAdding.html
Please let me know if you have any further questions concerning this matter.
I am following up to see if the information provided has resolved this matter.
Please let me know if I may be of further assistance with this matter.
Hi
Currently we are using Infragistics version 11.1 Ultrawebgrid. We are trying to migrate 11.1 version to 14.1 there is
Webdatagrid. we want add multiple rows add in webdatagrid on button click with all rows are enabled means primary key column enable true when add new rows.