Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrapTableFilter doesn't reload table #26

Open
maxfrz21 opened this issue Oct 5, 2015 · 1 comment
Open

bootstrapTableFilter doesn't reload table #26

maxfrz21 opened this issue Oct 5, 2015 · 1 comment

Comments

@maxfrz21
Copy link

maxfrz21 commented Oct 5, 2015

Hello,

I have this problem with your plugin: after applying filters with the command "bootstrapTableFilter (' getData ')", the linked table isn't reloaded. Filters are not executed.

I'm using last version of plugin.

The code is this:

$('#filter-bar').bootstrapTableFilter({
filters:[
{
field: 'descrizioneComune', // field identifier
label: 'descrizione Comune', // filter label
type: 'search' // filter type
},
{
field: 'supTot', // field identifier
label: 'Sup. (Kmq)', // filter label
type: 'range' // filter type
},
],
connectTo: '#comuniGALJson',
onSubmit: function() {
var data = $('#filter-bar').bootstrapTableFilter('getData');
console.log(data);
}
});

Thanks in advance,
Max

@maxfrz21
Copy link
Author

maxfrz21 commented Oct 6, 2015

I've found a solution for my issue...

  1. I've found a bug in "bs-table.js". At line 63 "filter" is not defined, so i've add declaration "var filter;"
  2. I've configured my custom table in this way:

$( document ).ready(function() {
$('#comuniGALJson').bootstrapTable(
{
queryParams: function(params)
{
var values = $('#filter-bar').bootstrapTableFilter('getData');
if ( !jQuery.isEmptyObject(values)) {
var elabFilter = JSON.stringify(values);
return elabFilter;
}
return params;
}
}
);

        $('#filter-bar').bootstrapTableFilter({
            filters:[
                {
                    field: 'descrizioneComune',   
                    label: 'descrizione Comune',  
                    type: 'search'   
                },
                {
                    field: 'supTot',    
                    label: 'Sup. (Kmq)',   
                    type: 'range'   
                },
            ],
            connectTo: '#comuniGALJson',
            onSubmit: function() {
                var data = $('#filter-bar').bootstrapTableFilter('getData');
                console.log(data);
            }
        });
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant