[Users] problem with search (formPanel)
Asma ouqalli
asma.ouqalli at gmail.com
Wed May 15 20:07:03 CEST 2013
Hello everybody,
am new to GeoEXT and am trying to do the search with form panel.
and i want to search features from 2 postgis table, corresponding the field
on the formpanel and show them on two separated grid panels,
when i hit the search button i get nothing on my gridpanel :s
here's my java script code:
// define the data source
var protocol= OpenLayers.Protocol.WFS({
url: "http://localhost:8080/geoserver/wfs",
featureType: "titres_salemed_valid",
featureNS: "http://geoserver.org/ancfcc"
});
var protocol2= OpenLayers.Protocol.WFS({
url: "http://localhost:8080/geoserver/wfs",
featureType: "bornes_salemed_valid",
featureNS: "http://geoserver.org/ancfcc"
});
formPanel = new Ext.form.FormPanel({
title: "Recherche T/R",
height: 200,
region: "north",
items: [{
xtype: "textfield",
name: "nature__eq",
value: "T",
fieldLabel: "Nature"
},{
xtype: "textfield",
name: "indice__eq",
value: "20",
fieldLabel: "Indice"
},{
xtype: "textfield",
name: "num__eq",
value: "",
fieldLabel: "Num:"
},{
xtype: "textfield",
name: "complement__eq",
value: "",
fieldLabel: "Complement:"
}],
// here action on search button
buttons: [{text: 'Localiser',
handler: function(){
// here to populate the store 2 with feature from table 2 defined by
protocol 2
formPanel.getForm().doAction(searchAction2, {
callback: function(response) {
features2 =
searchAction2.response.features;
store2.loadData(features2);
};
};
// here to populate the store with feature from table defined by protocol
formPanel.getForm().doAction(searchAction2, {
callback: function(response) {
features2 =
searchAction2.response.features;
store2.loadData(features2);
};
};
}
}]
});
var searchAction = new GeoExt.form.SearchAction(formPanel.getForm(), {
protocol: protocol,
abortPrevious: true
});
var searchAction2 = new GeoExt.form.SearchAction(formPanel.getForm(), {
protocol: protocol2,
abortPrevious: true
});
var cols = [ {name: 'titref', type: 'string'},
{name: 'mappe', type: 'string'},
{name: 'type', type: 'string'}
];
var reader = new GeoExt.data.FeatureReader({},cols);
var store = new GeoExt.data.FeatureStore({
reader: reader,
fields: cols,
autoLoad: false
});
// pour les titres
var cols2 = [ {name: 'name', type: 'string'},
{name: 'x', type: 'string'},
{name: 'y', type: 'string'}
];
var reader2 = new GeoExt.data.FeatureReader({},cols2);
var store2 = new GeoExt.data.FeatureStore({
reader: reader2,
fields: cols2,
autoLoad: false
});
// create grid panel configured with feature store
gridPanel = new Ext.grid.GridPanel({
title: "results",
region: "center",
store: store2,
height: 100,
columns: [{
header: "titref",
width: 200,
sortable: true,
dataIndex: "titref"
}, {
header: "mappe",
width: 60,
sortable: true,
dataIndex: "mappe"
}, {
header: "type",
width: 60,
align: 'right',
sortable: true,
dataIndex: "type"
}],
sm: select
});
// create grid panel configured with feature store for bornes layer
gridPanel2 = new Ext.grid.GridPanel({
title: "tableau des bornes",
region: "south",
store: store2,
height: 250,
columns: [{
header: "name",
width: 100,
sortable: true,
dataIndex: "name"
}, {
header: "x",
width: 120,
sortable: true,
dataIndex: "x"
}, {
header: "y",
width: 120,
align: 'right',
sortable: true,
dataIndex: "y"
}],
sm: select2
});
--
*Asma OUQALLI*
Élève ingénieur : 3ème Sciences d'Information Géographique (SIG).
Chef de commission développement professionnel - Rotaract EHTP.
Chef de cellule Media - Olympiades EHTP 2012.
Ecole Hassania des Travaux Publics.
Mobile : +212 672 48 23 15.
Email : asma.ouqalli at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20130515/1dc53557/attachment.htm
More information about the Users
mailing list