Flexigrid icon indicating copy to clipboard operation
Flexigrid copied to clipboard

flexAddData dissables buttons

Open wideawakening opened this issue 11 years ago • 1 comments

Hi there,

We've been in the need of adding more data to the JSON object that the servers returns to flexigrid (some time-related stats) and been unable to find a 'good' way to fetch this data from the flexigrid component.

Having this code in the submit button event of a filter-form things work ok, but we needed a way to obtain the resulting JSON of the petition.

$('#flexigridData').flexOptions({
    newp: 1,
    url:    'data?' + $('#filtrosForm').serialize()
}).flexReload();

So we turned into this code

$.ajax({
    url: 'data?' + $('#filtrosForm').serialize(),
    dataType: 'json',
    contentType: 'application/json',
    success: function(data, status, jqXHR) {

        // alert(JSON.stringify(data));

        // stats available in data bject                            

        // load flexigrid data
        $('#flexigridData').flexAddData(data).flexReload();
    }               
});

But this resulted in navigation buttons loosing their 'clickable' feature, such as when there are no items to navigate through.

Any tip?

The data added to flexigrid it's a valid flexigrid syntax JSON object, such as

{"page":1,"rows":[{"cell":....],"statsTimeES":172,"statsTimeHB":0,"statsTimeTotal":220,"total":3298462}

wideawakening avatar Apr 05 '13 08:04 wideawakening

Our temporary solution has been to modify flexigrid code to expose the JSON data object, and gather it in the exposed onSuccess function.

$('#flexigridData').flexOptions({
    newp: 1,
    url:    'data?' + $('#filtrosForm').serialize(),
    onSuccess: function(){

        //JSON.stringify(this.data);
        var data = this.data;

        // obtain the stats data
    }

}).flexReload();

Rather prefer not to modify the src code.

wideawakening avatar Apr 05 '13 08:04 wideawakening