jQWidgets Forums

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • in reply to: Nested DataTable Nested DataTable #89241

    Francisco
    Participant

    Tankk you Ivailo,

    If I need to put some text, title or other component on the same tab, would it be the same process with html?

    in reply to: Data Table – Date Data Table – Date #83445

    Francisco
    Participant

    Hello guys!

    Well, I found a technically simple solution to fix the date on your display in the DataTable, the database table I added the CURRENT_TIMESTAMP, and presto, end of story!

    I hope I never need to convert the timezone of the dates directly on the component! LOL

    Thank you

    in reply to: Print Charts Print Charts #82485

    Francisco
    Participant

    Good Morning,

    My question is too silly for you not answer me? Please help me!

    in reply to: Print Charts Print Charts #82291

    Francisco
    Participant

    Ha,

    when I use this feature,

    function getExportServer() {
    return ‘http://www.jqwidgets.com/export_server/export.php’;
    }

    everything works perfectly, so I think the error may be the way directories are organized and how I call the files!

    least the print logically!


    Francisco
    Participant

    I understand now, thank you, you saved me!


    Francisco
    Participant

    Good afternoon!

    After much thought I could prepare an example in jsFiddle, and is almost the same as mine. The difficulty lies in showing the sum of the Total column for each level of grouping, for example, if I group them with Cliente, or Unidade or Fornecedor, works perfectly, but if I group with 2 levels, Cliente and Unidade, the sum only It appears for Unidade and not for Cliente.

    Here is the link!
    https://jsfiddle.net/condeso/k1sasd5b/3/

    What I intend to do and group by “Cliente”, “Unidade” and “Fornecedor”, ie 3 grouping levels, how can I implement this in the function?


    Francisco
    Participant

    Well, so in this case I will show my code, but I believe this will not make a difference, because what I ALMECO and group with two, three or four layers layers and mater the total sum in each layer, but come on, see if that helps.

    var source = {
    dataType: “json”,
    datafields:
    [
    {name: ‘actions’, type: ‘string’},
    {name: ‘fornecedor’, type: ‘string’},
    {name: ‘posto’, type: ‘string’},
    {name: ‘pcnpj’, type: ‘string’},
    {name: ‘cliente’, type: ‘string’},
    {name: ‘unidade’, type: ‘string’},
    {name: ‘ucnpj’, type: ‘string’},
    {name: ‘numero’, type: ‘string’},
    {name: ’emissao’, type: ‘date’},
    {name: ‘total’, type: ‘string’},
    {name: ‘chave’, type: ‘string’},
    {name: ‘path’, type: ‘string’},
    {name: ‘import’, type: ‘date’}
    ],
    localdata: result
    };

    var dataAdapter = new $.jqx.dataAdapter(source);
    var toThemeProperty = function (className) {
    return className + ” ” + className + “-” + theme;
    };

    var groupsrenderer = function (text, group, expanded, data) {
    var number = dataAdapter.formatNumber(group, data.groupcolumn.cellsformat);
    var text = data.groupcolumn.text + ‘: ‘ + number;
    var aggregate = this.getcolumnaggregateddata(‘total’, [‘sum’], true, data.subItems);
    return ‘<div class=”‘ + toThemeProperty(‘jqx-grid-groups-row’) + ‘” style=”position: absolute;”><span>’ + text + ‘, </span>’ + ‘<span class=”‘ + toThemeProperty(‘jqx-grid-groups-row-details’) + ‘”>’ + “Total” + ‘ (‘ + aggregate.sum + ‘)’ + ‘</span></div>’;
    };

    $(“#tfechamento”).jqxGrid({
    width: ‘100%’,
    sortable: true,
    filterable: true,
    autoshowfiltericon: true,
    groupable: true,
    autorowheight: true,
    autoheight: true,
    altrows: true,
    localization: getLocalization(),
    columnsresize: true,
    showstatusbar: true,
    statusbarheight: 90,
    showaggregates: true,
    groupsrenderer: groupsrenderer,
    source: dataAdapter,
    columns: [
    {text: ‘Ações’, dataField: ‘actions’, width: ’80px’, cellsAlign: ‘right’},
    {text: ‘Fornecedor’, dataField: ‘fornecedor’, width: ‘100px’},
    {text: ‘Posto’, dataField: ‘posto’},
    {text: ‘Cliente’, dataField: ‘cliente’},
    {text: ‘Unidade’, dataField: ‘unidade’, width: ‘130px’},
    {text: ‘Número’, dataField: ‘numero’, cellsAlign: ‘right’, align: ‘left’, width: ’70px’, aggregates: [‘count’],
    aggregatesrenderer: function (aggregates, column, element) {
    var renderstring = “<div class=’jqx-widget-content’ style=’float: left; background-color: #e5e5e5; width: 100%; height: 100%; ‘>”;
    $.each(aggregates, function (key, value) {
    var name = ‘Qt’;
    renderstring += ‘<div style=”position: relative; margin: 6px; text-align: left; overflow: hidden;”>’ + name + ‘: <b>’ + value + ‘</b></div>’;
    });
    renderstring += “</div>”;
    return renderstring;
    }},
    {text: ‘Emissao’, dataField: ’emissao’, cellsAlign: ‘right’, align: ‘left’, cellsFormat: ‘d’, width: ‘100px’},
    {text: ‘Total’, dataField: ‘total’, cellsAlign: ‘right’, align: ‘left’, cellsFormat: ‘d2’, aggregates: [‘sum’, ‘max’, ‘avg’, ‘min’],
    aggregatesrenderer: function (aggregates, column, element) {
    var renderstring = “<div class=’jqx-widget-content’ style=’float: left; background-color: #e5e5e5; width: 100%; height: 100%; ‘>”;
    $.each(aggregates, function (key, value) {
    switch (key) {
    case ‘sum’:
    name = ‘Soma’;
    color = ‘#000000’;
    break;
    case ‘avg’:
    name = ‘Média’;
    color = ‘#666666’;
    break;
    case ‘min’:
    name = ‘Menor’;
    color = ‘#777777’;
    break;
    case ‘max’:
    name = ‘Maior’;
    color = ‘#555555’;
    break;
    }
    renderstring += ‘<div style=”color: ‘ + color + ‘; position: relative; margin: 6px; text-align: right; overflow: hidden;”>’ + name + ‘: <b>’ + value + ‘</b></div>’;
    });
    renderstring += “</div>”;
    return renderstring;
    }}
    ]
    });

    Okay, that’s it, now imagine that I want to group the following columns: 1º customer 2º unit 3º supplier
    but I want to bring up the total for all the customer’s total, total units of this client and the total supplier will be able to appear on each client drives, you know?


    Francisco
    Participant

    Good day Dimitar!
    So it’s almost that, but as I said yesterday, I need it to return me the total for each group and subgroup, and this example you gave me only returns the total for the subgroup, for instance, if I group by customer it I retonar the total per user (OK), but if I group by customer and customer units, it me the total for customer units and customer show the text undefined, you know?
    Another example of grouping, Customer, Customer Units and Supplier, was for him to return as each supplier produced for each customer unit (OK!) but also for the customer (the sum of all units) and it returns undefined!
    I sought some algorithm to identify subgroups or groups and make the sum by grouping layers, but I’m not so familiar, can you help me or show me an example?

    | Costumer x |—–| Customer Unit x|
    ___________________________________________________________________________________________________________________________
    | Customer | Customer Unit | Supplier | Supplier Unit | Day | Total |
    —————————————————————————————————————————-
    | > | Custumer A Total $50000 |
    —————————————————————————————————————————-
    | | > Unit A1 Total $ 25000 |
    —————————————————————————————————————————-
    | | > Unit A2 Total $ 10000 |
    —————————————————————————————————————————-
    | | > Unit A3 Total $ 15000 |
    —————————————————————————————————————————-
    | > | Custumer B Total $234000 |
    —————————————————————————————————————————-
    | | > Unit B1 Total $ 85000 |

    and so on!!!

    Currently it shows:

    ___________________________________________________________________________________________________________________________
    | > | Custumer B Total (undefined) <- the problem its here! |
    —————————————————————————————————————————-
    | | > Unit B1 Total $ 85000 |
    —————————————————————————————————————————-

    Thank you for your patience and didactic me!


    Francisco
    Participant

    Thank Ivailo

    in reply to: Aggregates on the group Aggregates on the group #76636

    Francisco
    Participant

    Thank Ivailo!!!

    It was exactly what I was trying to do, thanks for your insight!


    Francisco
    Participant

    I really did not return!

    Thank you!


    Francisco
    Participant

    Any?


    Francisco
    Participant

    See my example:

    This function receives parameters of an XML importer that le specific fields of the file and inserts in the DataTable, even though declaring the aggregates for the total column, it does not show the total! (even using update or refresh)

    addnfreg function (name, chNFe, NNF, dhEmi, VNF, pCNPJ, uCNPJ, pxNome, uxNome) {
                             $ (“# t_nf”). jqxDataTable (‘addRow’, null, {
                                 Files: name,
                                 Key: chNFe,
                                 number: NNF,
                                 issuance: dhEmi,
                                 post: pCNPJ,
                                 unit: uCNPJ,
                                 total: VNF,
                                 nposto: pxNome,
                                 nunidade: uxNome
                             }, ‘first’);
                             //$(“#t_nf”).jqxDataTable(‘update’);$(“#t_nf”).jqxDataTable(‘refresh’);
                         }


    Francisco
    Participant

    I will try to explain here even very simple!

    Imagine a table with the name, phone number, city and total price, right? It will be powered by the user, and when this finish entering data, the user clicks save, sending this data to the database.
    The only thing I can’t do is update the aggregates every time I add a new line.
    My clients need to read several xml files, so I created an importer, the importer read specific fields, such as those exemplified above, only that it does not update the total amount. Understood?

    Thanks.
    Francisco

    in reply to: Aggregates on the group Aggregates on the group #76382

    Francisco
    Participant

    OK, I get it, but imegine the following columns, for example, Customer, City, and Total, right?
    I would like to group by client, which is easy, use this:
                                        groups: [‘customer’],
                                         groupsRenderer: function (value, RowData, level) {
                                             return “Client: <b>” + value + “</ b>”;
                                         },
    Now comes the problem, as I would put the total for each client side in his name? Understood?

    I’m not grouping by all, just including this information in function groupsRender!

Viewing 15 posts - 1 through 15 (of 18 total)