Click here to Skip to main content
14,636,603 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hello all, i have a grid cell click method implemented using jquery as follows
function usercellclick() {

            $("#<%=dgv_buslayout.ClientID%> tr:has(td)").click(function (e) {
                var selTD = $(e.target).closest("td");
                var $target = $(e.target);
                if (!$target.is('input:checkbox')) {
                    $($target).find('input:checkbox').each(function () {
                        if (!$(this).prop('disabled')) {
                            if (this.checked) {
                                this.checked = false;
                                getseats();
                            }
                            else {
                                this.checked = true;
                                getseats();
                            }
                        }
                    })
                }
            });
 });
function getseats() {
            seatCheckUncheck(document.getElementById("<%= txtselectedseats.ClientID %>"), document.getElementById("<%=txtseatcount.ClientID %>"));
           
            OnSuccess();
        }
function OnSuccess() {
            var seatsCount = document.getElementById("<%= txtseatcount.ClientID %>").value;
            if (seatsCount == 0) {
                var row = $("[id*=dgv_passengerdetails] tr:last").clone(true);
                $("[id*=dgv_passengerdetails] tr").not($("[id*=dgv_passengerdetails] tr:first-child")).remove();
                $("td", row).eq(0).html('');
                $("[id*=dgv_passengerdetails]").append(row);
            }
            else{
                var row = $("[id*=dgv_passengerdetails] tr:last").clone(true);
                $("[id*=dgv_passengerdetails] tr").not($("[id*=dgv_passengerdetails] tr:first-child")).remove();
                var seats = (document.getElementById("<%= txtselectedseats.ClientID %>").value).split(",");
                for (var count = 0; count < seatsCount; count++) {
                    $("td", row).eq(0).html(seats[count]);
                    $("[id*=dgv_passengerdetails]").append(row);
                    row = $("[id*=dgv_passengerdetails] tr:last").clone(true);
                }
            }
        }

when i click continue 6 7 times it throws an exception as Maximum call stack size exceeded
if i remove the else part of function OnSuccess() then it works fine. help me, thanx in advance
Posted
Updated 2-Apr-19 18:24pm
Comments
Kornfeld Eliyahu Peter 12-May-14 4:24am
   
The error is about recursive calls. You fill up the queue. However it's not clear where exactly the recursion is, so you have to debug to see...
[no name] 12-May-14 5:01am
   
the debug show in jquery.min.js file
Kornfeld Eliyahu Peter 12-May-14 5:04am
   
Of course the failure is in jQuery after all...but you have to understand where in your code is the recursion!
[no name] 12-May-14 5:04am
   
when i remove the else part of OnSuccess() the code doesn't throw an exception. but there is might not be any line that causes recursion
Lord Perez 19-Aug-16 19:48pm
   
In your else clause you have for loop. Try printing variables count and seatsCount to see if you are ever leaving the loop. :3

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 2

Set the modal attribute to false

$("#dialog-edit").dialog({
                     resizable: false,
                     height: "auto",
                     width: 400,
                     modal: false,
                     autoOpen: false,
                     buttons: {
                         "Update Edit Values": function () {
                             APPROVE.modal.onSubmitEditedValues(this);
                             $(this).dialog("close");
                             return;
                         },
                         "Cancel Edit": function () {
                             APPROVE.modal.editOnUnCancel(this);

                             $(this).dialog("close");
                             return;
                         }
                     }
                 });
   
Comments
Richard Deeming 4-Apr-19 11:48am
   
Not even a vague attempt to answer the question!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100