jQWidgets Forums

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts

  • Bobo
    Participant

    Below my code, where is the issue??

    $(“#tblRelazioni”).jqxGrid({
    width: ‘99%’,
    height: tHeight,
    source: relSogAdapter,
    rowsheight: rowsH,
    columnsresize: true,
    sortable: true,
    editable: true,
    filterable:true,
    theme: style,
    localization: getLocalization(‘it’),
    selectionmode: ‘singlerow’,
    columns: [
    {text: ‘Anno’, datafield: ‘ANNO’, columntype: ‘int’, editable:false, hidden: true } ,
    {text: ‘Sog.’, datafield: ‘ID_SOGGETTO’, columntype: ‘int’, editable:false, hidden: true} ,
    {text: ‘Sog.’, datafield: ‘ID_SOGG_PAR_TUT’, columntype: ‘int’, editable:false, hidden: true} ,
    {text: ‘TipoSogg.’, datafield: ‘CD_TIPO_SOGGETTO’, columntype: ‘int’, editable:false, hidden: true} ,
    {text: ‘Rel.’, datafield: ‘ID_RELAZIONE’, columntype: ‘int’, editable:false, hidden: true} ,
    {text: ‘Relazione’, datafield: ‘DS_RELAZIONE’, columntype: ‘int’, editable:false, hidden: false, width: ‘10%’} ,
    {text: ‘Codice fiscale’, datafield: ‘CF’, columntype: ‘string’, editable: false, hidden: false, width: ‘20%’} ,
    {text: ‘M12’, datafield: ‘FL_MOD12’, columntype: ‘checkbox’, editable: true, hidden: false, width: ‘5%’} ,
    {text: ‘Nome’, datafield: ‘NOME’, columntype: ‘string’, editable: false, hidden: false, width: ‘13%’} ,
    {text: ‘Cognome’, datafield: ‘COGNOME’, columntype: ‘string’, editable: false, hidden: false, width: ‘13%’} ,
    {text: ‘Nato il’, datafield: ‘DT_NASCITA’, columntype: ‘date’, cellsformat: ‘dd/MM/yyyy’, width: “13%”, editable:false },
    {text: ‘CdNas’, datafield: ‘CD_COMUNE_NAS’, columntype: ‘string’, editable: false, hidden: true, width: ‘15%’} ,
    {text: ‘A’, datafield: ‘DS_COMUNE_NAS’, columntype: ‘string’, editable: false, hidden: false, width: ‘15%’} ,
    {text: ‘CdRes’, datafield: ‘CD_COMUNE_RES’, columntype: ‘string’, editable: false, hidden: true, width: ‘15%’} ,
    {text: ‘Residente a’, datafield: ‘DS_COMUNE_RES’, columntype: ‘string’, editable: false, hidden: false, width: ‘15%’} ,
    {text: ‘Indirizzo’, datafield: ‘INDIRIZZO_RES’, columntype: ‘string’, editable:false, width: “15%” },
    ],
    showtoolbar: true,
    rendertoolbar: function (statusbar) {
    var container = $(“<div style=’overflow: hidden; position: relative; margin: 5px;’></div>”);
    var addButton = $(“<div style=’float: left; margin-left: 5px;’><span style=’margin-left: 4px; position: relative; top: -3px;’>Nuovo</span></div>”);
    var deleteButton = $(“<div style=’float: left; margin-left: 5px;’><span style=’margin-left: 4px; position: relative; top: -3px;’>Elimina</span></div>”);
    var viewRelButton = $(“<div style=’float: left; margin-left: 5px;’><span style=’margin-left: 4px; position: relative; top: -3px;’>Vai a…</span></div>”);
    container.append(addButton);
    container.append(deleteButton);
    container.append(viewRelButton);
    statusbar.append(container);
    addButton.jqxButton({ width: 60, height: 20 });
    deleteButton.jqxButton({ width: 65, height: 20 });
    viewRelButton.jqxButton({ width: 65, height: 20 });
    addButton.click(function (event) {
    var offset = $(“#tblRelazioni”).offset();
    $(“#relazioniPopup”).jqxWindow({
    position: { x: parseInt(offset.left) + 5, y: parseInt(offset.top) – 100 },
    width: 280,
    resizable: false,
    isModal: false,
    autoOpen: false,
    cancelButton: $(“#relazioniCancel”),
    modalOpacity: 0.01,
    theme: style,
    initContent: function () {
    $(“#flM12”).jqxCheckBox({ width: ‘100%’, height: 25 });
    $(“#fldNomeRel”).jqxInput({ width: ‘100%’, height:23, height:23, theme: style });
    $(“#fldCognomeRel”).jqxInput({ width: ‘100%’, height:23, height:23, theme: style });
    $(“#fldDtNasRel”).jqxDateTimeInput({ culture: ‘it’, width: 150, height:23, theme: style });
    $(“#fldComuneNasRel”).jqxInput({ source: comuneAdapter, displayMember: “DATI_RICERCA”, placeHolder: “Citta nascita”, width: ‘100%’, height: 25, minLength: 1, maxLength: 30, theme:style});
    $(“#fldCdComuneNasRel”).jqxInput({});
    $(“#fldComuneResRel”).jqxInput({ source: comuneAdapter, displayMember: “DATI_RICERCA”, placeHolder: “Citta residenza”, width: ‘100%’, height: 25, minLength: 1, maxLength: 30, theme:style});
    $(“#fldCdComuneResRel”).jqxInput({});
    $(“#fldIndirizzoRel”).jqxInput({ placeHolder: “Indirizzo residenza”, width: ‘100%’, height: 25, minLength: 1, maxLength: 100, theme:style});
    }
    });
    $(“#relazioniPopup”).jqxWindow(‘open’);
    });
    deleteButton.click(function (event) {
    var selectedrowindex = $(“#tblRelazioni”).jqxGrid(‘getselectedrowindex’);
    var id = $(“#tblRelazioni”).jqxGrid(‘getrowid’, selectedrowindex);
    var row = $(“#tblRelazioni”).jqxGrid(‘getrowdatabyid’,id);
    $(“#tblRelazioni”).jqxGrid(‘deleterow’, id);
    });
    viewRelButton.click(function (event) {
    var selectedrowindex = $(“#tblRelazioni”).jqxGrid(‘getselectedrowindex’);
    var id = $(“#tblRelazioni”).jqxGrid(‘getrowid’, selectedrowindex);
    var row = $(“#tblRelazioni”).jqxGrid(‘getrowdatabyid’,id);
    if (row) {
    var pag;
    switch(row.CD_TIPO_SOGGETTO) {
    case ‘A’:
    pag = ‘Tesserato’;
    break;
    case ‘C’:
    pag = ‘Contatto’;
    break;
    case ‘R’:
    pag = ‘Contatto’;
    break;
    default:
    alert(“Paramentro non gestito”);
    }
    window.open(‘Rcm.php?Act=Nav&Pag=’+pag+’&IDS=’+row.ID_SOGGETTO, ‘_self’);
    }
    });
    }
    });

    in reply to: Chart from db query Chart from db query #112628

    Bobo
    Participant

    Hallo Hristo,

    these are chart settings:

    settings2 = {
    title: “Andamento Obiettivi nel periodo selezionato”,
    description: “”,
    source: adapter1,
    enableAnimations: true,
    showLegend: true,
    padding: { left: 10, top: 5, right: 10, bottom: 5 },
    titlePadding: { left: 50, top: 0, right: 0, bottom: 10 },
    xAxis:
    {
    dataField: ‘DT_EVENTO’,
    formatFunction: function (value) {
    var mm = value.getMonth() + 1, // getMonth() is zero-based
    dd = value.getDate();
    return [
    (dd>9 ? ” : ‘0’) + dd,
    (mm>9 ? ” : ‘0’) + mm,
    value.getFullYear()
    ].join(‘/’);
    },
    type: ‘date’,
    baseUnit: ‘month’,
    valuesOnTicks: true,
    minValue: dtIni,
    maxValue: dtFin,
    tickMarks: {
    visible: true,
    interval: 1,
    color: ‘#BCBCBC’
    },
    unitInterval: 1,
    gridLines: {
    visible: true,
    interval: 3,
    color: ‘#BCBCBC’
    },
    labels: {
    angle: -45,
    rotationPoint: ‘topright’,
    offset: { x: 0, y: -25 }
    }
    },
    valueAxis:
    {
    visible: true,
    title: { text: ‘Percentuale’ },
    tickMarks: { color: ‘#BCBCBC’ },
    maxValue: 100,
    minValue: 0,
    unitInterval: 10
    },
    colorScheme: ‘scheme04’,
    seriesGroups:
    [
    {
    type: ‘line’,
    series: [
    { dataField: ‘P_ESE_LUD’, displayText: ‘ESRCIZI LUDICI’ },
    { dataField: ‘P_LAV_FIS’, displayText: ‘LAVORO FISICO’ },
    { dataField: ‘P_MOV_DIF’, displayText: ‘MOVIMENTO DIFENSIFO’ },
    { dataField: ‘P_MOV_OFFF’, displayText: ‘MOVIMENTO OFFENSIVO’ },
    { dataField: ‘P_PRI_FAS’, displayText: ‘PRIMA FASE’ },
    { dataField: ‘P_REP’, displayText: ‘REPARTO’ },
    { dataField: ‘P_SKI’, displayText: ‘SKILLS’ }
    ]
    }
    ]
    }

    and this is the query that generate the adapter (query calculates cumulative values, this is the reason for the variables)

    select DT_EVENTO, MINUTI_ALLTO,
    MOV_DIF, @cumMOV_DIF := @cumMOV_DIF + MOV_DIF MOV_DIF_CUM, @cumMOV_DIF / minuti_allto * 100 P_MOV_DIF,
    LAV_FIS, @cumLAV_FIS := @cumLAV_FIS + LAV_FIS LAV_FIS_CUM, @cumLAV_FIS / minuti_allto * 100 P_LAV_FIS,
    ESE_LUD, @cumESE_LUD := @cumESE_LUD + ESE_LUD ESE_LUD_CUM, @cumESE_LUD / minuti_allto * 100 P_ESE_LUD,
    MOV_OFF, @cumMOV_OFF := @cumMOV_OFF + MOV_OFF MOV_OFF_CUM, @cumMOV_OFF / minuti_allto * 100 P_MOV_OFF,
    PRI_FAS, @cumPRI_FAS := @cumPRI_FAS + PRI_FAS PRI_FAS_CUM, @cumPRI_FAS / minuti_allto * 100 P_PRI_FAS,
    REP, @cumREP := @cumREP + REP REP_CUM, @cumREP / minuti_allto * 100 P_REP,
    SKI, @cumSKI := @cumSKI + SKI SKI_CUM, @cumSKI / minuti_allto * 100 P_SKI
    from
    (
    select a.dt_evento, MINUTI_ALLTO,
    sum(case when at.DS_OBIETTIVO = ‘MOVIMENTO DIFENSIVO’ then ifnull(e.QT_MINUTI_EFFETTIVI,0) else 0 end) MOV_DIF,
    sum(case when at.DS_OBIETTIVO = ‘LAVORO FISICO’ then ifnull(e.QT_MINUTI_EFFETTIVI,0) else 0 end) LAV_FIS ,
    sum(case when at.DS_OBIETTIVO = ‘ESERCIZI LUDICI’ then ifnull(e.QT_MINUTI_EFFETTIVI,0) else 0 end) ESE_LUD,
    sum(case when at.DS_OBIETTIVO = ‘MOVIMENTO OFFENSIVO’ then ifnull(e.QT_MINUTI_EFFETTIVI,0) else 0 end) MOV_OFF,
    sum(case when at.DS_OBIETTIVO = ‘PRIMA FASE’ then ifnull(e.QT_MINUTI_EFFETTIVI,0) else 0 end) PRI_FAS,
    sum(case when at.DS_OBIETTIVO = ‘REPARTO’ then ifnull(e.QT_MINUTI_EFFETTIVI,0) else 0 end) REP,
    sum(case when at.DS_OBIETTIVO = ‘SKILLS’ then ifnull(e.QT_MINUTI_EFFETTIVI,0) else 0 end) SKI
    from allto_albero_tecnico at
    join allto_allenamento a on a.cd_categ = ‘$cat’
    left join allto_esercizi e on e.DT_EVENTO = a.DT_EVENTO and e.CD_CATEG = a.CD_CATEG and e.ID_OGGETTO_ALLTO = at.ID_OGGETTO_ALLTO
    join (
    select DT_EVENTO, @min_tot := @min_tot + sum(ifnull(QT_MINUTI_EFFETTIVI,0)) MINUTI_ALLTO
    from allto_esercizi
    where ifnull(cd_categ,’$cat’) = ‘$cat’ and
    ifnull(dt_evento,str_to_date(‘$dtIni’,’%d/%m/%Y’)) between str_to_date(‘$dtIni’,’%d/%m/%Y’) and STR_TO_DATE(‘$dtFin’,’%d/%m/%Y’)
    group by DT_EVENTO
    ) min_tot on a.DT_EVENTO = min_tot.dt_evento
    where ifnull(a.cd_categ,’$cat’) = ‘$cat’ and
    ifnull(a.dt_evento,str_to_date(‘$dtIni’,’%d/%m/%Y’)) between str_to_date(‘$dtIni’,’%d/%m/%Y’) and STR_TO_DATE(‘$dtFin’,’%d/%m/%Y’)
    group by a.dt_evento, MINUTI_ALLTO
    ) A
    order by 1,2

    Let me know if you need any more details

Viewing 2 posts - 1 through 2 (of 2 total)