Show Posts
|
Pages: 1 2 [3] 4 5
|
31
|
General Category / Bug Report / Re: Infinite loop using scrollview in subgrid when empty data is returned
|
on: July 13, 2015, 12:26:26 AM
|
(Thanks for your quick response) Sorry: no luck. - First issue (lack of page & rows parameters on first request) now is solved - But second one ( infinite request loop when response is "empty" {"total":0,"rows":[]} ) still persists Again: when using scrollview in main datagrid everything works. Failure is only shown when using scrollview in subgrids EDIT: This one-liner patch solves second issue; but no idea about collateral effects easyui-1.4.2/extensions/datagrid-view/datagrid-scrollview.js --- datagrid-scrollview.js 2015-07-13 03:56:21.000000000 +0200 +++ AgilityContest/agility/lib/jquery-easyui-1.4.2/extensions/datagrid-view/datagrid-scrollview.js2015-07-13 09:35:13.773157146 +0200 @@ -374,7 +374,7 @@ if (data.rows && data.rows.length){ callback.call(opts.view, data.rows); } else { - opts.onLoadSuccess.call(target, data); + if (data.total!=0) opts.onLoadSuccess.call(target, data); } }, function(){ $(target).datagrid('loaded');
Juan Antonio
|
|
|
34
|
General Category / EasyUI for jQuery / Re: remove lines on layout when split is false
|
on: May 30, 2015, 10:10:40 PM
|
From your example code: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Basic Layout - jQuery EasyUI Demo</title> <link rel="stylesheet" type="text/css" href="../lib/jquery-easyui-1.4.2/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="../lib/jquery-easyui-1.4.2/themes/icon.css"> <link rel="stylesheet" type="text/css" href="../lib/jquery-easyui-1.4.2/demo/demo.css"> <script type="text/javascript" src="../lib/jquery-easyui-1.4.2/jquery.min.js"></script> <script type="text/javascript" src="../lib/jquery-easyui-1.4.2/jquery.easyui.min.js"></script> </head> <body> <h2>Basic Layout</h2> <p>The layout contains north,south,west,east and center regions.</p> <div style="margin:20px 0;"></div> <div class="easyui-layout" style="width:700px;height:350px;"> <div data-options="region:'north',split:false,border:false" style="height:50px"></div> <div data-options="region:'south',split:true" style="height:50px;"></div> <div data-options="region:'east',split:true,title:'hello'" style="height:50px;"></div> <div data-options="region:'west',split:true" style="width:100px;"></div> <div data-options="region:'center',title:'Main Title',iconCls:'icon-ok'"> <table class="easyui-datagrid" data-options="url:'../lib/jquery-easyui-1.4.2/lib/demo/layout/datagrid_data1.json',method:'get',border:false,singleSelect:true,fit:true,fitColumns:true"> <thead> <tr> <th data-options="field:'itemid'" width="80">Item ID</th> <th data-options="field:'productid'" width="100">Product ID</th> <th data-options="field:'listprice',align:'right'" width="80">List Price</th> <th data-options="field:'unitcost',align:'right'" width="80">Unit Cost</th> <th data-options="field:'attr1'" width="150">Attribute</th> <th data-options="field:'status',align:'center'" width="60">Status</th> </tr> </thead> </table> </div> </div>
</body> </html>
If you use "split:true,border:false" in "norht" region works fine, but setting both to "false" makes region dissappear Juan Antonio
|
|
|
35
|
General Category / EasyUI for jQuery / remove lines on layout when split is false
|
on: May 30, 2015, 11:11:57 AM
|
When using easyui-layout, Is there any way to remove "residual" lines when split is set to false in other regions than "center"? I've tried "border:false", but only seems to work in region:'center'. When applied to other regions just make them dissappear
Thanks in advance Juan Antonio
|
|
|
36
|
General Category / EasyUI for jQuery / Re: On-the-fly change datagrid view ¿is it possible?
|
on: May 21, 2015, 12:51:34 PM
|
OK. this works for me :-) function testAndSetView(dg,alternateView) { if (needAlternativeView()){ dg.datagrid({ view: alternateView, // set additional dg options groupField: 'NombreEquipo', groupFormatter: formatTeamResults }); // fix column visibility on new view dg.datagrid('hideColumn',"Logo"); } else { // set default view dg.datagrid({view:$.fn.datagrid.defaults.view}); // fix column visibility for this view dg.datagrid('showColumn',"Logo"); } // finally clear datagrid dg.datagrid('loadData', {"total":0,"rows":[]}); // dg.datagrid('reload'); }
Some issues still persist: - how can I remove alternateView extra options when switching to default? - when setting new view, datagrid is automagically rendered with old and useless data... any way to avoid this behaviour
|
|
|
37
|
General Category / EasyUI for jQuery / On-the-fly change datagrid view ¿is it possible? [SOLVED]
|
on: May 21, 2015, 09:22:57 AM
|
Hi all. Is it posible to change on-the-fly a datagrid view?. That is: function changeView(dg, alternateView) { if (typeof(myConfig.defaultView)==='undefined') myConfig.defaultView=dg.datagrid('opts',view); if (needAlternateView()){ dg.datagrid({view:alternateView}); dg.datagrid('hideColumn',"columnToHideInAltView"); } else { dg.datagrid({view:myConfig.defaultView}); dg.datagrid('showColumn',"columnToHideInAltView"); } dg.datagrid('reload'); }
If true, what's the way to initialize new view and reset to default one? Thanks in advance
|
|
|
38
|
General Category / EasyUI for jQuery / Re: Change height and background on groupview's group row
|
on: May 20, 2015, 02:55:21 AM
|
Fine... but now I'have another problem: I need to populate group row with several tabulated fields... and need to expand row to all the available space. something like: function myGroupRowFormatter(val,row) { .... /* generate data */ return '<table style="table-layout:fixed;width:100%"><tbody><tr>'+ '<td style="width:5%;"><img src="myLogo.png" alt="my logo" height="75"/></td>' + '<td style="width:55%;text-align:left;">Team: '+value+'</td>' + '<td style="width:20%;text-align:right;">Time: '+(time).toFixed(2)+'</td>' + '<td style="width:20%;text-align:right;">Penal.:'+(penal).toFixed(2)+'</td>'+ '</tr></tbody></table>'; }
But no success :-( table shrinks and don't know how to make "width=100%" get working Thanks in advance
|
|
|
39
|
General Category / EasyUI for jQuery / Change height and background on groupview's group row
|
on: May 18, 2015, 08:54:47 PM
|
Hi! I want to change group row in datagrid groupview, to change height, add a logo and set up row bg and fg colors. I wrote something like: groupFormatter: function(club,rows){ // set proper colors on team rows var fg='<?php echo $config->getEnv('vw_hdrfg2'); ?>'; var bg='<?php echo $config->getEnv('vw_hdrbg2'); ?>'; var logo='<img width="40" height="40" alt="'+rows[0]['LogoClub']+'" src="/agility/images/logos/'+rows[0]['LogoClub']+'"/>' return <span style="height:40px;line-height:40px;font-size:1.5em;font-weight:bold;background-color:' + bg + ';color:' + fg + ';font-weight:bold;">' + logo +' - ' + club + '</span>'; }
But no success ¿Any idea? Thanks in advance Juan Antonio
|
|
|
40
|
General Category / EasyUI for jQuery / Re: An easy way to sort groups in datagrid groupview [SOLVED]
|
on: May 01, 2015, 03:36:45 AM
|
Finally I found the problem: groupFormatter's table width and datagrid scrollbar
When scrollbar appears, the group header width becomes greater than available space... and inline-block's display attributes, makes it to be rendered at next line... and thus not shown. Just setting up the right width value, gets allways displayed as expected
I'll investigate how to automagically expand table width to fit available space, but not now :-)
Thanks. Juan Antonio
|
|
|
41
|
General Category / EasyUI for jQuery / Re: An easy way to sort groups in datagrid groupview ?
|
on: May 01, 2015, 01:03:55 AM
|
sure: groupFormatter relevant code: // this works, but I want to tabulate output // return "Equipo: "+value+" Tiempo: "+time+" Penalización: "+penal;
// this only works when at least one group row is collapsed return '<table class="team-results"><tbody><tr>'+ '<td>Team: '+value+'</td><td>Time: '+time+'</td><td>Penalization:'+penal+'</td>'+ '</tr></tbody></table>';
CSS style used: .team-results {display:inline-block;table-layout:fixed; width:725px;}/*Setting the table width is important!*/ .team-results td {overflow:hidden;}/*Hide text outside the cell.*/ .team-results td:nth-of-type(1) {width:325px;}/*Setting the width of column 1.*/ .team-results td:nth-of-type(2) {width:200px;}/*Setting the width of column 2.*/ .team-results td:nth-of-type(3) {width:200px;}/*Setting the width of column 3.*/
When at least one group row is collapsed, every thing works as expected. Here comes my capture showing DOM inspector: But when all group rows are expanded, text dissappears... but DOM Inspector says it is still there: I suspect any issue on groupview renderer code , but unsure.. Juan Antonio
|
|
|
42
|
General Category / EasyUI for jQuery / Re: An easy way to sort groups in datagrid groupview ?
|
on: April 30, 2015, 05:16:14 PM
|
Thanks! With a minor changes it works for me /** * Extension del datagrid groupview para ordenar los grupos */ var gview = $.extend({}, groupview, { onBeforeRender: function(target, rows){ groupview.onBeforeRender.call(this, target, rows);
var state = $.data(target, 'datagrid'); var opts = state.options; var groups = this.groups; groups.sort(function(a,b){ var p1 = sumValue(a.rows, 'Penalizacion'); var p2 = sumValue(b.rows, 'Penalizacion'); var t1 = sumValue(a.rows, 'Tiempo'); var t2 = sumValue(b.rows, 'Tiempo'); // compare penalization if (p1!=p2) return (opts.sortOrder=='asc'?1:-1)*(p1>p2?1:-1); // on equal penalization compare time return (opts.sortOrder=='asc'?1:-1)*(t1>t2?1:-1); }); var index = 0; var newRows = []; for(var i=0; i<groups.length; i++){ var group = groups[i]; group.startIndex = index; index += group.rows.length; newRows = newRows.concat(group.rows); } state.data.rows = newRows;
function sumValue(rows,field) { var v = 0; for (var n = 0; n < 3; n++) { if (typeof(rows[n]) === 'undefined') { v += 200; } // if less than 3 participants else { v+=parseFloat(rows[n][field]); } } return v; } } })
A last two questions: - "rownumbers" options affect data rows, not group rows. Any way to change this behaviour? - Today Upgraded to easyui-1.4.2... and my group formatter method doesn't run anymore :-( I'd like groupFormatter to generate a table-like text info, but seems that datagrid css styles overrides mine when group rows are expanded. ¿Any way to solve this? Thanks in advance Juan Antonio
|
|
|
43
|
General Category / EasyUI for jQuery / An easy way to sort groups in datagrid groupview [SOLVED]
|
on: April 29, 2015, 01:21:48 PM
|
I'm looking for a solution to show datagrid groups sorted in an specific order provided by evaluating some fields from group members My groupFormater() function comes here: // value: Team name // rows: competitor's group members. Best results comes first function myGroupFormatter( value , rows ) { var time=0; var penal=0 for (n=0;n<3;n++) { // get the three best competitor's and sum their results if ( typeof(rows[n])==='undefined') { penal+=200;} else {penal+=parseFloat(rows[n].Penalization); time+=parseFloat(rows[n].Time);} } return '<table><tr><td style="width:325px">Team's name: '+value+ '</td><td style="width:200px">Time: '+time+ '</td><td style="width:200px">Penalization: '+penal+ '</td></tr></table>'; }
... And I want datagrid groups gets shown ordered by evaluated group time/penalization ¿Any suggestion?. Looking at groupview code, I figure some kind of sorting once the datagrid elements have been parsed and group list composed, but unsure about right way to do in a generic way Thanks in advance. Juan Antonio
|
|
|
44
|
General Category / EasyUI for jQuery / Re: Datagrid: fire onLoadSuccess just once
|
on: February 03, 2015, 09:22:02 AM
|
Sorry, perhaps my question was a bit malformed: my code is something like: function one() { .... $(dg).datagrid('load',data1); return; } function two() { .... $(dg).datagrid('load',data2); /* something to do AFTER load success */ .... } function three() { .... $(dg).datagrid('load',data3); return; } I want to be able to call onLoadSuccess(), but only on function two(). Due to async nature of ajax call in 'load', I cannot simply add required code bellow So I'm looking for: - A way to enable/disable onLoadSuccess at an specific point, without affecting others Or - Add a sort of method like datagrid('load').done() Juan Antonio
|
|
|
45
|
General Category / EasyUI for jQuery / Datagrid: fire onLoadSuccess just once
|
on: February 02, 2015, 05:53:09 AM
|
Hi all Any easy way to fire datagrid onLoadSuccess just once? Something like: function loadAndFire() { $('#my-datagrid').datagrid( 'load', { Prueba: workingData.prueba, Jornada: workingData.jornada , Manga: workingData.manga , Operation: 'getData' } ).done(function(data) {myFiredFunction(data);} ); }
Thanks in advance Juan Antonio
|
|
|
|