PDA

View Full Version : (Solved) Grid filtering beginner issue



cmueller
7 Jun 2010, 11:44 AM
Hallo together,

sorry probably I'm having a realy beginning question, but I'm new in ExtJs.

I need a filterable/sortable grid. So I started with the examples and finished very fast my first grid. (Only sortable).
I've tried to keep everying stupid easy. Now I'm having issues by adding the filtering part to my existing grid.

The filter is now visible in the headline, but when I write anything into the box, I only get an "this.proxy is undefined errror".
(Additional question: Is it right to use the filter extension out of the examples/ux folder ?)

Here is my easy keept code: (Thank you in advange)


<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css">
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all-debug.js"></script>

<!-- Grid Filter -->
<script type="text/javascript" src="ext/examples/ux/gridfilters/GridFilters.js"></script>
<script type="text/javascript" src="ext/examples/ux/gridfilters/filter/Filter.js"></script>
<script type="text/javascript" src="ext/examples/ux/gridfilters/filter/StringFilter.js"></script>
<!-- Grid Filter End-->

<script type="text/javascript">

Ext.onReady(function(){

var rawdata = [
['One','1'],
['One One','1'],
['Two','2']
];

var datastore = new Ext.data.ArrayStore({
fields: [
{name: 'appl'},
{name: 'farm'}
]
});

datastore.loadData(rawdata);

var filters = new Ext.ux.grid.GridFilters({
filters: [{
type: 'string',
dataIndex: 'appl'
}]
});

var grid = new Ext.grid.GridPanel({
store: datastore,
columns: [
{id:'appl', header:'Application Name', dataIndex:'appl', sortable:true},
{header:'Citrix Farm', dataIndex:'farm', sortable:true}
],
renderTo: 'grid',
autoExpandColumn: 'appl',
width: 600,
height: 400,
title: 'Applications',
plugins: [filters]
});

});

</script>
<style>
body { padding: 10px; }
</style>
</head>
<body>
<div id="grid" name="grid"></div>
</body>
</html>

prakashpaudel
8 Jun 2010, 12:57 AM
You are using the ArrayStore so I assume you are trying to filter the grid data locally. May be the default GridFilters filter mode is


local: false

The local:false mode try to reload the store with it's proxy.
Try this for local filtering


var filters = new Ext.ux.grid.GridFilters({
filters: [{
type: 'string',
dataIndex: 'appl'
}],
local:true
});

cmueller
8 Jun 2010, 9:06 AM
Worked. Thank you very much.