locked
Need inputs on calling jquery from angular2 RRS feed

  • Question

  • User-531736323 posted

    I have built a grid using kendogrid wrapped with angular2. the grid is getting populated with records by consuming the webapi service. Moreover I need to raise a rowclick event on the grid and on the click event, I need to fetch the record/async call to get the details for the row/record selected and display below on the same page. The details sections consists of around 10-12 textbox and I should be able to bind the values fetched from the services call.

    My UI looks like this, I have a grid in the top section - the grid is loaded with some record by consuming the services. When the user click on a any single row, the below details section controls to be loaded with the details values fetched by the asynch call.

    I have given below a sample code to achieve the above required functionality in JQuery way. But i need some inputs in doing it in angular2 way. any ideas/suggestions ?

    $(.kendogridcell).click(){
    queueID = $(currentrow).children("gridcell")[0].val();//To fetch the key/ID which is used for retreiving by the service call
        $.ajax()
        {
            url:'http://sampleservice',
            data:data,
            success(function(response)
            {
                $("#txtapplication").val(response.applicationName);
                $("#JobName").val(response.JobName);
                ....
                ....
            });
        }
    
    });//end gridcell click event
    Tuesday, June 28, 2016 9:00 PM

All replies

  • User61956409 posted

    Hi snkrishnan1,

    According to your description and code, we could find that you’d like to attach click event to element and send ajax request to fetch data from server, and you’d like to implement same functionality with AngularJS 2. You could check this link to know how to attach click event.

    http://learnangular2.com/events/

    <button (click)="yourfunctionname()">Click</button>

    And you could check the following link to know how to make http requests.

    http://www.syntaxsuccess.com/viewarticle/angular-2.0-and-http

    Best Regards,

    Fei Han

    Wednesday, June 29, 2016 7:23 AM
  • User-531736323 posted

    Hi Fei Han,

    Thanks for your answer. actually I am in need of raising/handling the click event for a grid row in the kendo-grid. Since I am using 3rd party component the grid rows/cells are generated by the component and here I wont be able to associate any specific event as long as the component provides by default.

    I am expecting something like the functionality in this demo http://demos.telerik.com/kendo-ui/grid/events

    The specified demo is in Jquery and I want to handle the same onchange event in Angular2 component, 

    any ideas on how to accomplish this?

    Regards,

    Krishnan

    Wednesday, June 29, 2016 3:03 PM
  • User-1926401737 posted

    hi,

    you could ask “integrate angular with kendo-grid” issue on Kendo UI forum.

    http://www.telerik.com/forums/kendo-ui/grid

    Friday, July 8, 2016 8:54 AM