jQWidgets Forums

jQuery UI Widgets Forums Grid page reloads after re setting source dataadapter

This topic contains 1 reply, has 1 voice, and was last updated by  omargarro 10 years, 2 months ago.

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

  • omargarro
    Participant

    Hi, I have this issue:

    Page loads and everything is just fine. The grid looks fine with the records retrieved from getControlTAT.php

    Now… on button’s click, I have to change the grid’s source dataadapter.

    What is happening is that page reloads itself (entirely, like location.reload() ), bringing again the records set originally.
    I confirm this because the alert message alert(1) displays after clicking on button.

    $(function() {

    alert(1);

    var source = {
    cache: false, datatype: “json”, url: ‘reportes/getControlTAT2.php’, type: ‘post’,
    data: { controlar: $(“#controlar”).val(), desde: $(“#desde”).val(), hasta: $(“#hasta”).val() },
    datafields: [
    { name: ‘Coord1’, type: ‘string’},
    { name: ‘COD_PPG’, type: ‘int’},
    { name: ‘NRO_PRT’, type: ‘int’},
    { name: ‘FEC_HOR_REC_FIN’, type: ‘string’},
    { name: ‘Vencimiento’, type: ‘string’},
    { name: ‘TAT’, type: ‘string’},
    { name: ‘ESTADO’, type: ‘string’},
    { name: ‘Estado_Delphos’, type: ‘string’},
    { name: ‘Comentario’, type: ‘string’}
    ]
    };
    var dataadapter = new $.jqx.dataAdapter(source);

    $(“#dataGrid”).jqxGrid( {
    width: 1000, height: 450, source: dataadapter, columnsresize: true, editable: true,
    columns: [
    { text: ‘Team’, datafield: ‘Coord1’, width: 125 },
    { text: ‘Estudio’, datafield: ‘COD_PPG’, width: 75 },
    { text: ‘Protocolo’, datafield: ‘NRO_PRT’, width: 85 },
    { text: ‘Recepcion’, datafield: ‘FEC_HOR_REC_FIN’, width: 100 },
    { text: ‘Vencimiento’, datafield: ‘Vencimiento’, width: 100 },
    { text: ‘TAT’, datafield: ‘TAT’, width: 50 },
    { text: ‘Estado NEXT’, datafield: ‘ESTADO’, width: 140 },
    { text: ‘Estado Delphos’, datafield: ‘Estado_Delphos’, width: 140 },
    { text: ‘Comentarios’, datafield: ‘Comentario’, width: 210 }
    ]
    });

    $(“#buscar”).button( { icons: { primary: “ui-icon-search” } }).click( function() {
    var newSource = {
    cache: false, datatype: “json”, url: ‘reportes/getControlTAT.php’, type: ‘post’,
    datafields: [
    { name: ‘Coord1’, type: ‘string’},
    { name: ‘COD_PPG’, type: ‘int’},
    { name: ‘NRO_PRT’, type: ‘int’},
    { name: ‘FEC_HOR_REC_FIN’, type: ‘string’},
    { name: ‘Vencimiento’, type: ‘string’},
    { name: ‘TAT’, type: ‘string’},
    { name: ‘ESTADO’, type: ‘string’},
    { name: ‘Estado_Delphos’, type: ‘string’},
    { name: ‘Comentario’, type: ‘string’}
    ]
    };

    var newDataAdapter = new $.jqx.dataAdapter(newSource);
    $(‘#dataGrid’).jqxGrid( { source: newDataAdapter } );

    });

    });

    I should say that getControlTAT2.php and getcontrolTAT.php delivers the same info ( one of them delivers 10 records, the other 20)

    Help please !


    omargarro
    Participant

    eyyy… after a while I found the problem

    The only button I had was included inside a <form> so it was acting like a submit button.

    removing the form or preventing default behaviour of that form, solved the problem

    thanks anyway

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

You must be logged in to reply to this topic.