jQWidgets Forums
jQuery UI Widgets › Forums › Grid › jqxgrid mastergrid perform using button click on each row
Tagged: grid, javascript grid, jquery grid, jqwidgets grid
This topic contains 5 replies, has 2 voices, and was last updated by Hristo 8 years, 2 months ago.
-
Author
-
Hi I used the sample master detail grid, and I am trying to figure out if there is a way to update the data source of the detail grid through using button click. I create a button column using the cellsrenderer, but I cannot seem to perform the similar function of the rowselect by using the button on each row.
Here is my jsfiddle:
https://jsfiddle.net/UbK74/426/Could use help on this?
Hello dan123,
You want to when the click particular (custom) button to select the row. Could you clarify?
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comYes hristo
Yes when I press the button for that row, it will bring the details for that row.
Hello dan123,
You could use
selectrow
method when clicking on the button (need to implementbuttonclick
callback of the column).
Please, take a look at this example:<!DOCTYPE html> <html lang="en"> <head> <title id='Description'></title> <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/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.pager.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxnumberinput.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxwindow.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxinput.js"></script> <script type="text/javascript" src="../../scripts/demos.js"></script> <script type="text/javascript" src="generatedata.js"></script> <script type="text/javascript"> $(document).ready(function () { // prepare the data var data = generatedata(200); var source = { localdata: data, datatype: "array", datafields: [ { name: 'firstname', type: 'string' }, { name: 'lastname', type: 'string' }, { name: 'productname', type: 'string' }, { name: 'quantity', type: 'number' }, { name: 'price', type: 'number' } ] }; var dataAdapter = new $.jqx.dataAdapter(source); // initialize jqxGrid $("#jqxgrid").jqxGrid( { width: 850, source: dataAdapter, pageable: true, autoheight: true, selectionmode: 'checkbox', columns: [ { text: 'First Name', datafield: 'firstname', width: 200 }, { text: 'Last Name', datafield: 'lastname', width: 200 }, { text: 'Product', datafield: 'productname', width: 190 }, { text: 'Quantity', datafield: 'quantity', width: 90, cellsalign: 'right' }, { text: 'Price', datafield: 'price', width: 90, cellsalign: 'right', cellsformat: 'c2' }, { text: 'Edit', datafield: 'Edit', columntype: 'button', cellsrenderer: function () { return "Edit"; }, buttonclick: function (row) { $('#jqxgrid').jqxGrid('selectrow', row); } } ] }); }); </script> </head> <body class='default'> <div id='jqxWidget'> <div id="jqxgrid"></div> </div> </body> </html>
You need to decide how to proceed when having the second click on the button. Also, how to visualize the data in the Grid below.
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.