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
285
Iggrid selection and delete event firing at the same time
posted

Hi,

I am using the iggrid to show some data. Now I have the requirement where on Grid Row selection details view opens up also if I hover over the row, the delete button should appear [standard delete functionality as provided by iggrid]. I am using jquery widgets for both the summary and details view.

Now, the problem is - Whenever I click the delete button, the selection changed event gets fired and the navigation moves to the details view. Is there any way, I can stop firing the selection changed event whenever the delete event is raised ? 

 

I am pasting the code that I am using in this context : 

 gridElement.igGrid({

                autoGenerateColumns: false,

                dataSource: igDs,

                autoAdjustHeight: false,

                columns: [

                    { headerText: "Login Name", key: "LoginName", dataType: "string" },

{ headerText:"First Name", key: "FirstName", dataType: "string" },

{ headerText: "Last Name", key: "LastName", dataType: "string" }

],

                features: [{

                    name: "Sorting",

                    type: "local"

                },

                  {

                      name: 'Selection',

                      mode: 'row',

                      mouseDragSelect: true,

                      activeRowChanging: function (e, args) {

                          //alert("Selection changed");

                          var username = args.row.element[0].cells[0].textContent;

                          var state = $.bbq.getState() || {};

                          state.layout = "userdetail";

                          state.username = username;

                          $.bbq.pushState(state, 2);

                      }

                  },

                  {

                      name: 'Updating',

                      enableAddRow: false,

                      editMode: 'none',

                      enableDeleteRow: true,

                      // event raised before row was deleted

                      rowDeleting: function (e, args) {

                          var username = args.element[0].cells[0].textContent;

                          var confirmmsg = confirm("Do you want to delete user :" + username);

                          if (confirmmsg) {

 

                              //                          that.options.sendRequest({

                              //                                  url: "/UserAdmin/DeleteUser/username" + username,

                              //                                  success: function (data) {

                              //                                      alert(data);

                              //                                  }

                              //                              });

 

                          }

                          return false;

                      }

                  }

 

Parents
No Data
Reply
  • 23953
    Offline posted

    Hello anirbankundu1981,

    The reason activeRowChanging event is rised on row delete is that you're trying to delete different row from the currently selected. Current behaviour of the igGrid is that it first tries to select the row before deleting it. This is a bug and we're going to fix it in the next release. If you need a fast solution of this problem we can think of a workaround.

    Best regards,

    Martin Pavlov

Children