jQWidgets Forums

jQuery UI Widgets Forums Grid How to subscribe on error loading data for grid

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 7 years, 6 months ago.

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

  • Admir Hodžić
    Participant

    My jqGrid fetch data from remote conntoler.
    I did it conustuct like

    var sourceGridInternih = {
        dataFields: [{
            name: 'id',
            type: 'int'
        },
            {
                name: 'sklId',
                type: 'int'
            },
            {
                name: 'vsklId',
                type: 'int'
            },{
                name: 'skl',
            type: 'string'
        }, {
                name: 'vskl',
            type: 'string'
        }, {
            name: 'datum',
            type: 'date'
        }, {
                name: 'datumDo',
                type: 'date'
        }, {
                name: 'broj',
            type: 'string'
        }, {
                name: 'status',
            type: 'string'
        }, {
                name: 'statuscode',
            type: 'string'
        }, {
                name: 'tag',
            type: 'string'
        }, {
                name: 'napomena',
                type: 'string'
        }, {
                name: 'izradio',
                type: 'string'
        }
        ],
        id: 'id',
        async: false,
        type: 'POST',
        dataType: 'json',
        url: '../../InterneNarudzbe/GridDokumenata',
        cache: false,
        formatData: function (data) {
            return {
                odDatuma: $("#odDatuma").val(),
                doDatuma: $("#doDatuma").val(),
                sklFilter: $("#filterSklIsporuci").val(),
                vsklFilter: $("#filterSklNarucici").val(),
                filterStatus: $("#filterStatus").val(),
                filterTag: $("#filterTag").val(),
                grupaRjFilter: $("#grupaRjFilter").val()
            };
        },
        data: {}
    };
    var adapterGridInternih = new $.jqx.dataAdapter(sourceGridInternih, {
        formatData: function (data) {
            //data.tabelaId = tabelaId
            return data;
        }
    
    });
    
    $(document).ready(function () {
    $("#gridInternih").jqxGrid({
            source: adapterGridInternih
        });
    });

    This works perfectly,
    In other places in code I do refres by

    $('#gridInternih').jqxGrid('updatebounddata', 'data');

    Sometimes controller fail to response data to ajax call.
    In that cases grid refreshes without rows.
    And user get message There is no tow for display

    In chrome console I do get error
    POST http://localhost:60208/InterneNarudzbe/GridDokumenata net::ERR_CONNECTION_REFUSED
    But end users does not hold console open.

    I want to subscribe to this error so I can printout user error to explain him that tere was error.


    Hristo
    Participant

    Hello Admir Hodžić,

    The formatData callback is a part of the DataAdapter. Please, take a look our API Documentation.
    Also, you could find there loadError(jqXHR, status, error) a callback function called when the request has failed.
    About the DataAdapter’s source it has determinated options – including the datafields have specific values. Possible values: ‘string’, ‘date’, ‘number’, ‘float’, ‘int’ and ‘bool’.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.