jQWidgets Forums
Forum Replies Created
-
Author
-
Thanks, Dimitar
but unfortunately I am not an experienced programmer, I have to implement this code?:
var customsortfunc = function (column, direction) { var sortdata = new Array(); if (direction == 'ascending') direction = true; if (direction == 'descending') direction = false; if (direction != null) { for (i = 0; i < data.length; i++) { sortdata.push(data[i]); } } else sortdata = data; var tmpToString = Object.prototype.toString; Object.prototype.toString = (typeof column == "function") ? column : function () { return this[column] }; if (direction != null) { sortdata.sort(compare); if (!direction) { sortdata.reverse(); } } source.localdata = sortdata; $("#jqxgrid").jqxGrid('updatebounddata', 'sort'); Object.prototype.toString = tmpToString; } // custom comparer. var compare = function (value1, value2) { value1 = String(value1).toLowerCase(); value2 = String(value2).toLowerCase(); try { var tmpvalue1 = parseFloat(value1); if (isNaN(tmpvalue1)) { if (value1 < value2) { return -1; } if (value1 > value2) { return 1; } } else { var tmpvalue2 = parseFloat(value2); if (tmpvalue1 < tmpvalue2) { return -1; } if (tmpvalue1 > tmpvalue2) { return 1; } } } catch (error) { var er = error; } return 0; };
could you kindly give me an example related to my case?
Best regards,
AmatoMarch 3, 2016 at 12:17 pm in reply to: How to insert into db from grid to another grid How to insert into db from grid to another grid #82072Hi Ivo,
you can see an example of data.php code?
thanks advance,
Best Regards,
AmatoMarch 2, 2016 at 1:43 pm in reply to: How to insert into db from grid to another grid How to insert into db from grid to another grid #82039Thanks for answer Ivo,
I need to insert directly into mysql db table and then do a refresh,
sorry but the example does not work?
Best Regards,
AmatoFebruary 25, 2016 at 8:44 am in reply to: Problem select data row from button Problem select data row from button #81823Hi Dimitar,
actually this code with id_squadra was only a test as:
}, buttonclick: function (row) { var editrow = row; var dataRecord = $("#jqxgrid1").jqxGrid('getrowdata', editrow); var id_squadra = $id_squadra; alert(id_squadra);
you can see in the first post the code that I had put was correct but it worked, but now works with your directives.
Thanks for your patience and professionalism you showed.
how do I close the discussion resolved?
Best regards,
AmatoFebruary 24, 2016 at 12:16 pm in reply to: Problem select data row from button Problem select data row from button #81775There is no error, that does not work is the piece of code that
}, buttonclick: function (row) { var editrow = row; var dataRecord = $("#jqxgrid1").jqxGrid('getrowdata', editrow); alert(dataRecord.id_giocatore);
but beware, if I call this same code over via an external html file works, I believe that this is due to the interpretation of the url
anyway that’s all the code:
<?php $user = JFactory::getUser(); if (!$user->guest) { $utente=$user->id; } $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('id_squadra, sq_id_utente, sq_nome_squadra, sq_crediti_iniziali, sq_crediti_iniziali, sq_crediti_residui, sq_valore_rosa'); $query->from('fcw_squadre'); $query->where('sq_id_utente='.$utente.''); $db->setQuery((string)$query); $datasq=$db->loadObjectList(); echo "<div class=moduleclass_sfx $params->get('moduleclass_sfx', '') >"; echo '<form action="" method="post">'; echo "<select name='select_squadra'>"; echo "<option value=''>Seleziona la squadra</option>"; foreach ( $datasq as $i=>$datasq): echo "<option value='$datasq->id_squadra'>$datasq->sq_nome_squadra</option>"; endforeach; echo "</select>"; echo "<input id='gobutton' type='submit' name='submit' value='Conferma'/>"; echo "</form>"; echo "</div>"; if(isset($_POST['select_squadra'])){ $select_squadra = $_POST['select_squadra']; //echo "<div class='divbottoni'>"; //echo "<a href='http://www.fantacalcioworld.it/libraries/jqx/compra_portiere.html?id_squadra=$select_squadra' target='_blank' rel='lightbox' class='jcepopup noicon link-button button-green' data-mediabox-group='lightbox' data-mediabox-width='550' style='margin-bottom: 10px;'>Compra un Portiere</a>"; //echo "</div>"; } ?> <!DOCTYPE html> <html lang="it"> <head> <style> div#jqxgrid{ margin-left:auto; margin-right:auto; float:left; } div#jqxgrid1{ float:right; } input#gobutton{ cursor:pointer; /*forces the cursor to change to a hand when the button is hovered*/ padding:2px 15px; /*add some padding to the inside of the button*/ margin: 10px; margin-bottom: 22px; background:#35b128; /*the colour of the button*/ border:1px solid #33842a; /*required or the default border for the browser will appear*/ /*give the button curved corners, alter the size as required*/ -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; /*give the button a drop shadow*/ -webkit-box-shadow: 0 0 4px rgba(0,0,0, .75); -moz-box-shadow: 0 0 4px rgba(0,0,0, .75); box-shadow: 0 0 4px rgba(0,0,0, .75); /*style the text*/ color:#f3f3f3; font-size:1.1em; .divBottoni button{ cursor:pointer; /*forces the cursor to change to a hand when the button is hovered*/ padding:2px 15px; /*add some padding to the inside of the button*/ margin: 10px; margin-bottom: 22px; background:#35b128; /*the colour of the button*/ border:1px solid #33842a; /*required or the default border for the browser will appear*/ /*give the button curved corners, alter the size as required*/ -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; /*give the button a drop shadow*/ -webkit-box-shadow: 0 0 4px rgba(0,0,0, .75); -moz-box-shadow: 0 0 4px rgba(0,0,0, .75); box-shadow: 0 0 4px rgba(0,0,0, .75); /*style the text*/ color:#f3f3f3; font-size:1.1em; display:inline; margin : 0.1%; } } input#gobutton:hover, input#gobutton:focus{ background-color :#399630; /*make the background a little darker*/ /*reduce the drop shadow size to give a pushed button effect*/ -webkit-box-shadow: 0 0 1px rgba(0,0,0, .75); -moz-box-shadow: 0 0 1px rgba(0,0,0, .75); box-shadow: 0 0 1px rgba(0,0,0, .75); } </style> </head> <body class='default'> <div id="jqxgrid"></div> <div id="jqxgrid1"></div> </body> </html> <script type="text/javascript"> jQuery(document).ready(function ($) { // prepare the data var source = { datatype: "json", datafields: [ { name: 'rs_ruolo', type: 'string'}, { name: 'gt_nome', type: 'string'}, { name: 'sqc_logo', type: 'string'}, { name: 'sqc_squadra', type: 'string'}, { name: 'rs_valore', type: 'int'} ], url: '/libraries/jqx/rosa.php?select_squadra=<?php echo $select_squadra;?>', cache: false }; var imagerenderer = function (row, datafield, value) { return '<img style="margin-left: 5px; margin-top: 5px;" height="35" width="auto" src="' + value + '"/>'; }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid( { width: 610, height: 600, source: dataAdapter, theme: 'base', rowsheight: 35, columns: [ { text: 'Ruolo', datafield: 'rs_ruolo', width: 50}, { text: 'Nome', datafield: 'gt_nome', width: 180 }, { text: '', datafield: 'sqc_logo', width: 50, cellsrenderer: imagerenderer }, { text: 'Squadra', datafield: 'sqc_squadra', width: 180 }, { text: 'Valore', datafield: 'rs_valore', width: 50 }, { text: 'Azione', datafield: 'Edit', width: 100, columntype: 'button', cellsrenderer: function () { return "Vendi"; }, buttonclick: function (row) { editrow = row; alert("premuto"); } } ] }); }); </script> <script type="text/javascript"> jQuery(document).ready(function ($) { // prepare the data var source1 = { datatype: "json", datafields: [ { name: 'id_giocatore', type: 'string'}, { name: 'gt_nome', type: 'string'}, { name: 'gt_squadra', type: 'string'}, { name: 'gt_quota', type: 'int'} ], url: '/libraries/jqx/portieri.php', cache: false }; var imagerenderer = function (row, datafield, value) { return '<img style="margin-left: 5px; margin-top: 5px;" height="35" width="auto" src="' + value + '"/>'; }; var dataAdapter = new $.jqx.dataAdapter(source1); var editrow = -1; $("#jqxgrid1").jqxGrid( { width: 500, height: 600, source: dataAdapter, theme: 'base', selectionmode: 'singlerow', rowsheight: 35, 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 "Compra"; }, buttonclick: function (row) { var editrow = row; var dataRecord = $("#jqxgrid1").jqxGrid('getrowdata', editrow); var id_squadra = $id_squadra; alert(id_squadra); //alert("Premuto"); } } ] }); }); </script>
If you want you can give the site access to private Credentials
thanks.
February 24, 2016 at 10:53 am in reply to: Problem select data row from button Problem select data row from button #81771thank you very much for your reply,
I did everything exactly as you explained, but I have not yet solved the problem described beforeany idea?
Best Regards,
AmatoThanks 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
-
AuthorPosts