user1161960
user1161960

Reputation: 90

flexigrid refresh using javascript

Refresh the flexigrid data on dropdown (select) index changed or rebind the flexigrid on index change in javascript or clear the flexigrid data on select change

Upvotes: 2

Views: 7736

Answers (3)

user3263221
user3263221

Reputation: 11

For efficient reloading, you can try this:

$("#flexigrid")[0].grid.populate()

Upvotes: 0

joedborg
joedborg

Reputation: 18343

If you're just looking to bind the grid's refresh with another element, you can use

$('#flex1').flexReload()

Upvotes: 3

ajay swamy
ajay swamy

Reputation: 271

I have done the following. On selection change of the Severity, the flexigrid reloads with the data for the selected severity

<select id='ddlSeverity' onchange="setSeverity($('#ddlSeverity option:selected').attr('value'));">
                            <option value="1">Severity 1</option>
                            <option value="2">Severity 2</option>
                            <option value="3">Severity 3</option>
                            <option value="4">Severity 4</option>
</select>



$(document).ready(function () {

 function setSeverity(severity) {
//Construct the URL to be called. 
        var urlAction = '@Url.Action("RequestQueueBySeverity", "Home", new { severity = "__BOGUS__" })';
//Replace the bogus parameter with the parameter to be passed
        urlAction = urlAction.replace("__BOGUS__", severity);

        $('#flex1')
        .flexOptions({
            url: urlAction,
            newp: 1
        }).flexReload();
    }

}

Please mark as answer if it works for you..

Upvotes: 1

Related Questions