jQWidgets jqxGrid cellbeginedit Event - GeeksforGeeks

03 Nov, 2021
jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxGrid is used to illustrate a jQuery widget that shows data in tabular form. Moreover, it renders full support for connecting with data, as well as paging, grouping, sorting, filtering, and editing.
The cellbeginedit event is activated whenever the editor of a cell of a displayed jqxGrid is shown.
Syntax:
$("#Selector").on('cellbeginedit', function (event) {
   // Arguments of the event
   var args = event.args;
  
   // Data field of the column
   var dataField = event.args.datafield;
  
   // Bound index of the row
   var rowBoundIndex = event.args.rowindex;
  
   // Value of the cell
   var value = args.value;
   
   // Data of the row
   var rowData = args.row;
});
Linked Files: Download jQWidgets from the given link. In the HTML file, locate the script files in the downloaded folder.
<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” /><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/jqx-all.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/jqxscrollbar.js”></script><script type=”text/javascript” src=”jqwidgets/jqxmenu.js”></script><script type=”text/javascript” src=”jqwidgets/jqxgrid.js”></script><script type=”text/javascript” src=”jqwidgets/jqxgrid.selection.js”></script>
Example: The below example illustrates the jqxGrid cellbeginedit event in jQWidgets.
HTML
<!DOCTYPE html><html lang="en">  <head>    <link rel="stylesheet" href=        "jqwidgets/styles/jqx.base.css" type="text/css" />    <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/jqx-all.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/jqxscrollbar.js"></script>    <script type="text/javascript"         src="jqwidgets/jqxmenu.js"></script>    <script type="text/javascript"         src="jqwidgets/jqxgrid.js"></script>    <script type="text/javascript"         src="jqwidgets/jqxgrid.selection.js"></script></head>  <body>    <center>        <h1 style="color:green">            GeeksforGeeks        </h1>          <h3>jQWidgets jqxGrid cellbeginedit Event        </h3>        <br/>          <div id="jqxg"></div>        <br/>                <div id="log"></div>    </center>      <script type="text/javascript">                $(document).ready(function () {            var d = new Array();            var subjectNames =                ["C++", "Scala", "Java", "C", "R", "JavaScript"];              var pageNumber =                ["7", "8", "12", "11", "10", "19"];              for (var j = 0; j < 50; j++) {                var r = {};                r["subjectnames"] =                    subjectNames[Math.floor(                        Math.random() * subjectNames.length)                    ];                  r["pagenumber"] =                    pageNumber[Math.floor(                        Math.random() * pageNumber.length)                    ];                d[j] = r;              }            var src = {                localdata: d,                datatype: "array",            };            var data_Adapter = new $.jqx.dataAdapter(src);            $("#jqxg").jqxGrid({                source: data_Adapter,                editable: true,                selectionmode: 'singlecell',                theme: 'energyblue',                height: "260px",                width: "240px",                columns: [                    {                        text: "Subject Name",                        datafield: "subjectnames",                        width: "120px",                    },                    {                        text: "Page No.",                        datafield: "pagenumber",                        width: "120px",                    },                ],            });              $("#jqxg").on("cellbeginedit", function (event) {                $('#log').html(                    "Index of row to be eidted: "                         + event.args.rowindex                );            });        });    </script></body>  </html>
Output:
Reference: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm?search=
jQuery-jQWidgets
jQWidgets-jqxGrid
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
JQuery | Set the value of an input text field
Form validation using jQuery
How to change selected value of a drop-down list using jQuery?
How to change the background color after clicking the button in JavaScript ?
How to fetch data from JSON file and display in HTML table using jQuery ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?