Show Posts
|
Pages: [1] 2
|
2
|
General Category / EasyUI for jQuery / [SOLVED]How can i appendRow in groupFormatter?
|
on: July 26, 2016, 07:31:11 AM
|
Can someone help me? I need to show the sum of each group. im Trying to do this: $(dg).datagrid({ method: "POST", url: "app/retorno.php", queryParams: {requisicao: 'percent',compet: compet,ap:title}, singleSelect:true, collapsible:true, fitColumns:true, showFooter: true, view:groupview, groupField:'NOME_UB', groupFormatter:function(values,rows){ var total_unidade_benef = 0; var total_unidade_acomp = 0; var total_unidade_nao_acomp = 0; for (var i = 0; i < rows.length; i++) { total_unidade_benef = total_unidade_benef + parseInt(rows[i].TOTAL_GERAL); total_unidade_acomp = total_unidade_acomp + parseInt(rows[i].TOTAL_ACOMP); total_unidade_nao_acomp = total_unidade_nao_acomp + parseInt(rows[i].TOTAL_NAO_ACOMP); } /* $(dg).datagrid('appendRow',{ COD_AREA: 'TOTAL UNIDADE', TOTAL_GERAL:total_unidade_benef, TOTAL_ACOMP:total_unidade_acomp, PERCENT_ACOMP:'', TOTAL_NAO_ACOMP:total_unidade_nao_acomp, PERCENT_NAO_ACOMP:'' });*/ return values; }, groupStyler:function(value,rows){ // deixar a linha com nome da unidade azul //#337ab7 return 'background-color:#769dbe;color:white'; }, rowStyler: function(index,row){// pintar a linha dos sem equipe de 'vermelho' if(row.COD_AREA == ''){ return 'background-color:#f9d7d8;color:black;'; } }, onLoadSuccess:function(){ // deixar os collapse fechado exceto o primeiro var gcount = $(this).datagrid('options').view.groups.length; for(var i=1; i<gcount; i++){ $(this).datagrid('collapseGroup', i); } }, width:'98%', height:'500', columns:colunas });
But im getting this message: 'Uncaught RangeError: Maximum call stack size exceeded'.
|
|
|
4
|
General Category / EasyUI for jQuery / Why client side pagination dont work with filter and sorting on datagrid??
|
on: October 03, 2015, 10:02:00 PM
|
I cant put to work,when I use the three features together, or pagination not working or filter. Can anyone help me? Thats my cod for pagination: function pagerFilter(data){ if (typeof data.length == 'number' && typeof data.splice == 'function'){ // is array data = { total: data.length, rows: data } } var dg = $(this); var opts = dg.datagrid('options'); var pager = dg.datagrid('getPager'); pager.pagination({ onSelectPage:function(pageNum, pageSize){ opts.pageNumber = pageNum; opts.pageSize = pageSize; pager.pagination('refresh',{ pageNumber:pageNum, pageSize:pageSize }); dg.datagrid('loadData',data); } }); if (!data.originalRows){ data.originalRows = (data.rows); } if (!opts.remoteSort && opts.sortName){ var target = this; var names = opts.sortName.split(','); var orders = opts.sortOrder.split(','); data.originalRows.sort(function(r1,r2){ var r = 0; for(var i=0; i<names.length; i++){ var sn = names[i]; var so = orders[i]; var col = $(target).datagrid('getColumnOption', sn); var sortFunc = col.sorter || function(a,b){ return a==b ? 0 : (a>b?1:-1); }; r = sortFunc(r1[sn], r2[sn]) * (so=='asc'?1:-1); if (r != 0){ return r; } } return r; }); } var start = (opts.pageNumber-1)*parseInt(opts.pageSize); var end = start + parseInt(opts.pageSize); data.rows = (data.originalRows.slice(start, end)); return data; }
and this is my datagrid: $('#dg').datagrid({ title:'dg', data: result, striped: true, fitColumns:true, singleSelect:true, pagination:true, idField:'id', loadFilter:pagerFilter, remoteSort:false, multiSort:true, pageSize:20, toolbar:[{ iconCls: 'icon-excel', text:'Export', handler: function(){alert('excel')} },'-',{ iconCls: 'icon-help', handler: function(){alert('help')} }], columns:[[ {field:'id',title:'id',width:13 ,align:'center',sortable:true}, {field:'name',title:'name',width:50 ,align:'center',sortable:true} ]] }); //fim datagrid }
and i already set the filter: $(function(){ var dg = $('#dg').datagrid(); dg.datagrid('enableFilter') }
|
|
|
5
|
General Category / EasyUI for jQuery / Disable combobox on Editable row Datagrid
|
on: May 30, 2014, 11:17:06 AM
|
Good afternoon, I would like to disable a combobox in datagrid which is editable line with, that would be the only other editable fields. this is my code: columns:[[ {field:'id',title:'Matérias',width:270,align:'left', formatter:function(value,row){ return row.codmat; }, editor:{ type:'combobox', options:{ url:'app/historico.app.php?Ajax=ListarCombobox&matricula='+matricula+'&idmat='+idmat, //combobox de materias valueField:'id', textField:'codmat', required:true, onBeforeLoad: function(){ var row = $('#tt').datagrid('getSelected'); idmat = row.id; //alert(idmat); } } } }, {field:'cargah',title:'CH',width:70,align:'center',editor:'numberbox'}, {field:'ano1',title:'ANO 1',width:70,align:'center',editor:{type:'numberbox',options:{ formatter:ver, parser:exibir }} }, {field:'ano2',title:'ANO 2',width:70,align:'center',editor:{type:'numberbox',options:{ formatter:ver, parser:exibir }} }, {field:'ano3',title:'ANO 3',width:70,align:'center',editor:{type:'numberbox',options:{ formatter:ver, parser:exibir }} }, {field:'ano4',title:'ANO 4',width:70,align:'center',editor:{type:'numberbox',options:{ formatter:ver, parser:exibir }} }, {field:'ano5',title:'ANO 5',width:70,align:'center',editor:{type:'numberbox',options:{ formatter:ver, parser:exibir }} }, {field:'ano6',title:'ANO 6',width:70,align:'center',editor:{type:'numberbox',options:{ formatter:ver, parser:exibir }} }, {field:'ano7',title:'ANO 7',width:70,align:'center',editor:{type:'numberbox',options:{ formatter:ver, parser:exibir }} }, {field:'ano8',title:'ANO 8',width:70,align:'center',editor:{type:'numberbox',options:{ formatter:ver, parser:exibir }} }, {field:'ano9',title:'ANO 9',width:70,align:'center',editor:{type:'numberbox',options:{ formatter:ver, parser:exibir }} }, ]] });
var editIndex = undefined; function endEditing(){ if (editIndex == undefined){return true} if ($('#tt').datagrid('validateRow', editIndex)){ $('#tt').datagrid('selectRow', editIndex) .datagrid('beginEdit', editIndex); var ed = $('#tt').datagrid('getEditor', {index:editIndex,field:'id'}); var descricao = $(ed.target).combobox('getText'); $('#tt').datagrid('getRows')[editIndex]['codmat'] = descricao; $('#tt').datagrid('endEdit', editIndex); editIndex = undefined; return true; } else { return false; } } function onClickRow(index){ //começar edicao if (editIndex != index){ if (saveit()){ $('#tt').datagrid('selectRow', index) .datagrid('beginEdit', index); editIndex = index; } else { $('#tt').datagrid('selectRow', editIndex); } } }
sorry my bad english. Thanks.
|
|
|
9
|
General Category / EasyUI for jQuery / Numberbox format to 5 or 5.1 not 5.0 [SOLVED]
|
on: May 22, 2014, 06:27:30 AM
|
Good day, I would use the number box to create student grades in high school, however the number rounds to integer. Need to be allowed to place or integer (5) when he put the precision 2 rounds (5.0) but I need to stay (5) or (5.2). Could someone help me? sorry for my bad english. {field:'ano1',title:'ANO 1',width:70,align:'center',editor:{type:'numberbox'}},
|
|
|
14
|
General Category / EasyUI for jQuery / Row Editing in DataGrid save function
|
on: May 09, 2014, 10:01:38 AM
|
Hello, im starting with easyui and i would like to save the lines of editable datagrid. I have this code for Row editing: var editIndex = undefined; function endEditing(){ if (editIndex == undefined){return true} if ($('#tt').datagrid('validateRow', editIndex)){ var ed = $('#tt').datagrid('getEditor', {index:editIndex,field:'id'}); var descricao = $(ed.target).combobox('getText'); $('#tt').datagrid('getRows')[editIndex]['codmat'] = descricao; $('#tt').datagrid('endEdit', editIndex); editIndex = undefined; return true; } else { return false; } } function onDblClickRow(index){ if (editIndex != index){ if (endEditing()){ $('#tt').datagrid('selectRow', index) .datagrid('beginEdit', index); editIndex = index; } else { $('#tt').datagrid('selectRow', editIndex); } } } and must pass all the data to the php and db. Someone can tell me how starts?
|
|
|
15
|
General Category / EasyUI for jQuery / Re: Filter and Virtual Scroll View in one Datagrid
|
on: December 02, 2013, 07:17:30 AM
|
i have this for now
index: <table id="dgfor" class="easyui-datagrid" title="Selections" style="width:800px;height:400px" data-options=" view:scrollview, pageSize:20, url:'show.php', iconCls:'icon-ok', singleSelect:'true'"> <thead> <tr> <th data-options="field:'codforn',width:120">Cod</th> <th data-options="field:'name',width:350">Name</th> <th data-options="field:'selec',width:100,align:'center'" >Selecionar</th> </tr> </thead> </table>
Js: $(function(){ var dg = $('#dgfor').datagrid({remoteFilter:true,url:'teste.filter.php'}); dg.datagrid('enableFilter', [{ field:'codforn', type:'label' }, { field:'name', type:'text', op:['contains','equal'], }, { field:'selec', type:'label', }]); });
and looks like this function overwrite the url of show.php
|
|
|
|