Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
425
Adding multiple rows to Infragistics webdatagrid without hitting database
posted

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 = "";

            }

        }

        else {

            type = "IE";

            if (tbl.rows[i].cells[0].childNodes[1].childNodes[0].checked) {

                chkd = "CHECKED";

            }

            else {

                chkd = "";

            }

        }

        if (chkd.search("CHECKED") != -1) {

            if (type == "IE") {

                isbn = ExtractString(tbl.rows[i].cells[1].innerText);

            }

            else {

                isbn = ExtractString(tbl.rows[i].cells[1].childNodes[1].innerHTML);

            }

            if (isbn.length > 8) {

                if (type == "IE") {

                    title = ExtractString(tbl.rows[i].cells[2].innerText);

                    prn = ExtractString(tbl.rows[i].cells[3].innerText);

                    subacct = ExtractString(tbl.rows[i].cells[4].innerText);

                }

                else {

                    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

Parents Reply Children
No Data