jQWidgets Forums

jQuery UI Widgets Forums Grid event.args is undefined

This topic contains 1 reply, has 2 voices, and was last updated by  Christopher 8 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • event.args is undefined #85810

    KBhima
    Participant

    Hi,
    Am trying to edit a grid row using angularjs and jqwidgets. The requirement is when I click on a row, the row details should be shown on a input form from where I can edit and save back to the grid. Am using the grids “begincelledit”.
    But it always returns me event.args is undefined error.Following is the piece of code where am doing the editing.
    ` $scope.edit = function(event)
    {
    var args = event.args;

    $scope.jqxInput(“A cell has been clicked:” + args.rowindex + “:” + args.datafield);

    };
    Any demos I can follow ?

    event.args is undefined #85828

    Christopher
    Participant

    Hi KBhima,

    this demo shows how to implement the event handling functionality you want:

    <!DOCTYPE html>
    <html ng-app="demoApp">
    <head>
        <title id="Description">jqxGrid directive for AngularJS</title>
        <link rel="stylesheet" type="text/css" href="../../jqwidgets/styles/jqx.base.css" />
        <script type="text/javascript" src="../../scripts/angular.min.js"></script>
        <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.edit.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxangular.js"></script>
        <script type="text/javascript" src="../../scripts/demos.js"></script>
        <script type="text/javascript">
            var demoApp = angular.module("demoApp", ["jqwidgets"]);
            demoApp.controller("demoController", function ($scope) {
                // Grid data.
                $scope.people = [{
                    id: 1,
                    name: "Pedro",
                    age: 13
                }, {
                    id: 2,
                    name: "Clara",
                    age: 22
                }, {
                    id: 3,
                    name: "John",
                    age: 33
                }, {
                    id: 4,
                    name: "Pier",
                    age: 27
                }];
                $scope.grid = {};
                $scope.settings =
                {
                    altrows: true,
                    width: 500,
                    height: 300,
                    editable: true,
                    selectionmode: 'singlecell',
                    ready: function () {
                        $scope.grid.selectrow(1);
                    },
                    source: $scope.people,
                    columns: [
                        { text: 'Id', dataField: 'id', width: 150 },
                        { text: 'Name', dataField: 'name', width: 200 },
                        { text: 'Age', dataField: 'age', width: 150 }
                    ]
                };
                $scope.edit = function (event) {
                    alert("editing:" + " "+event.args.datafield+" that has a value of: "+event.args.value);
                };
            });
        </script>
    </head>
    <body>
        <div ng-controller="demoController">
            <jqx-grid jqx-on-cellbeginedit="edit()" jqx-instance="grid" jqx-settings="settings"></jqx-grid>
        </div>
    </body>
    </html>
    

    Best Regards,
    Christopher

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.