jQWidgets Forums
jQuery UI Widgets › Forums › Grid › get row data not working
Tagged: angular grid, bootstrap grid, Button, javascript grid, jquery grid, jqwidgets grid, jqxgrid
This topic contains 3 replies, has 2 voices, and was last updated by Hristo 9 years, 5 months ago.
-
Authorget row data not working Posts
-
Goodmorning everyone,
I am several days that I see examples and do testing but I can not in any way to be able to view the data line using button.
where am I wrong?Please help me.
<!DOCTYPE html> <html lang="it"> <head> <link rel="stylesheet" href="libraries/jqx/jqwidgets/styles/jqx.base.css" type="text/css" /> <link rel="stylesheet" href="libraries/jqx/jqwidgets/styles/jqx.ui-redmond.css" type="text/css" /> <script type="text/javascript" src="libraries/jqx/scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxgrid.sort.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxmenu.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxgrid.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxgrid.pager.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxgrid.selection.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxnumberinput.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxwindow.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxdropdownlist.js"></script> <script type="text/javascript" src="libraries/jqx/jqwidgets/jqxinput.js"></script> <script type="text/javascript" src="libraries/jqx/scripts/demos.js"></script> </head> <body class='default'> <div id='jqxWidget'> <div id="jqxgrid"></div> </div> </body> </html> <script type="text/javascript"> $(document).ready(function () { // prepare the data var source = { datatype: "json", datafields: [ { name: 'id_giocatore', type: 'string'}, { name: 'gt_nome', type: 'string'}, { name: 'gt_squadra', type: 'string'}, { name: 'gt_quota', type: 'int'} ], url: '/jsntime/libraries/jqx/portieri.php', cache: false }; var dataAdapter = new $.jqx.dataAdapter(source); var editrow = -1; $("#jqxgrid").jqxGrid( { width: 500, height: 500, source: dataAdapter, theme: 'base', selectionmode: 'singlerow', columns: [ { text: 'Id', datafield: 'id_giocatore', width: 50}, { text: 'Nome', datafield: 'gt_nome', width: 150 }, { text: 'Squadra', datafield: 'gt_squadra', width: 150 }, { text: 'Valore', datafield: 'gt_quota', width: 50 }, { text: 'Azione', datafield: 'Edit', width: 80, columntype: 'button', cellsrenderer: function () { return "Edit"; }, buttonclick: function (row) { var editrow = row; var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); alert(dataRecord.gt_nome); } } ] }); }); </script>
Hello amatost,
Need to correct some points in that code.
1. The tag<script>
with$(document).ready(function () {...});
must be in <head> or in <body> tags.
2. Need to check it is a correct url address.
Everything else looks fine.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comThanks Hristo,
I corrected as I have indicated, but I did not understand the point 2, what purpose exactly?
Because I believe that the problem is in step 2, because if the sample files directly from the browser works perfectly, while I can not make it work. Could you explain the concept of accuracy of the url?Thank you for your availability
Hello amatost,
Not something special. Only you should be sure that is the correct address of data. (ex. in same directory /dir/file.txt or directory in another location ../dir/file.txt)
And are you sure the server is started because sometimes happen that.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.