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
915
Grid Id from event
posted

I have bound to the 'rendered' event and would like to retrieve the Grid ID in the event handler but 'ui.owner.grid.id' Throws an error indicating that the 'grid' is undefined or null?

How would I go about retrieving the ID of the grid in the event handler? Also is there any documentation showing what should be available from the 'ui' object?

Thank You.

  • 17590
    Offline posted

    Hello jagsoft,

    Thank you for posting in our community.

    In the rendered event you can get a reference to the event`s element id either via the ui or evt arguments using attr() method. For example:

    //using ui argument

    rendered: function(evt, ui){
         var gridElement = $(ui.owner.element).attr("id"),
          gridID = gridElement.attr("id");
          
          alert("Grid id is: " + gridID);
        }

    //using evt argument

    rendered: function(evt, ui){
         var gridElement = $(evt.target),
          gridID = gridElement.attr("id");
          
          alert("Grid id is: " + gridID);
        }

    I am also attaching a small sample illustrating my suggestion. Please have a look at this sample an let me know if you need any further assistance with this matter.

    In case that you would like to insect what information is available in each argument my suggestion is to put a breakpoint in the events handler and inspect the arguments using the developers console.

    Please do not hesitate to contact me if you have any additional questions.

    igGridRenderedEvent.zip