Demo - FlexGridFilter no Thousand Separators
HTML
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cdn.wijmo.com/5.latest/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.input.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.filter.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.odata.min.js"></script>
<div class="container">
<h1>
FlexGridFilter</h1>
<div id="theGrid">
</div>
<button id='btn'>
change source
</button>
</div>
CSS
.wj-flexgrid {
max-height: 250px;
margin:10px 0;
}
body {
margin-bottom: 20px;
}
JavaScript
function getData(count){
var data=[],
countries = 'US,Germany,UK,Japan,Italy,Greece'.split(',');
for (var i = 0; i < count; i++) {
data.push({
id: i,
country: countries[i % countries.length],
downloads: Math.round(Math.random() * 20000),
sales: Math.random() * 10000,
expenses: Math.random() * 5000,
});
}
return data;
}
onload = function () {
// generate some random data
var data = getData(500),
cv;
var postNo=1;
cv=new wijmo.collections.CollectionView();
// FlexGridFilter client-side filtering
var theGrid = new wijmo.grid.FlexGrid('#theGrid', {
autoGenerateColumns: false,
columns: [
{ binding: 'postId', format: 'f0' },
{ binding: 'id' },
{ binding: 'name' },
{ binding: 'email', format: 'f2' },
],
itemsSource: cv,
});
var filter = new wijmo.grid.filter.FlexGridFilter(theGrid);
var filterCols="id,postId".split(',');
filter.filterColumns=filterCols;
//track changes
cv.trackChanges=true;
cv.sourceCollectionChanged.addHandler(()=>{
console.log('source collection changed fired');
console.log('sc',cv);
});
cv.collectionChanged.addHandler(()=>{
console.log('collection changed fired');
console.log('cc',cv);
console.log('items edited',cv.itemsEdited);
});
var btn=document.querySelector('#btn');
btn.onclick=()=>{
changeSourceAjax();
};
changeSourceAjax();
function changeSourceAjax(){
var baseURL='https://jsonplaceholder.typicode.com/posts/';
fetch(baseURL+postNo+"/comments")
.then(response => response.json())
.then(json => cv.sourceCollection=json);
if(++postNo>100){
postNo=1;
}
}
}