[Users] "GeoExt.grid.FeatureSelectionModel()" destroys Layout
Andreas Hocevar
ahocevar at opengeo.org
Sat Jan 22 13:22:44 CET 2011
Hi,
there is already a ticket for this, and it is being worked on (thanks Matt Priour). See http://trac.geoext.org/ticket/396 - and please report whether the 2nd patch there works for you.
Regards,
Andreas.
On Jan 22, 2011, at 11:40 , geographika wrote:
> Glad you got it sorted.
> The order in ExtJS normally does not matter when using the declarative
> approach to defining objects.
>
> For reference/GeoExt developers a fix could be to modify
> FeatureSelectionModel.js
>
> line 153:
>
> var map = layer.map || GeoExt.MapPanel.guess().map;
> map.addControl(selectControl);
>
> Or maybe register an event on the layer to run createSelectControl on
> "loadstart"?
>
> I can create a ticket, although maybe this is the desired behaviour?
>
> On 20/01/2011 18:51, Christian Willmes wrote:
>> Hi,
>>
>> I was not aware, that order of code matters here, but good to know!
>>
>> I rearranged the code, so that the vectorLayer Sites is added to the map
>> before the grid gets initialized.
>>
>> Now the "sm: new GeoExt.grid.FeatureSelectionModel()" does not break the
>> layout any more, which is great, but the OpenLayersMap now shows a
>> "bluescreen".
>>
>> -> http://www.sfb806db.uni-koeln.de/irtg_webgis/app-sent-to-geoext.html
>>
>> And of course I use firebug, but I did not get that error if I used it
>> on my local files, I just got it if I used it on the uploded version,
>> requesting it via http fromthe server...
>>
>> In the version I uploaded now to the server, I get still the
>> "this.mapObject is null" error, It indicates that it originates from
>> Line 512 in my code, which is:
>> items: [mappanel,tree,legend,descpanel]
>>
>> in the panl = new Ext.Panel() function at the very bottom of the code,
>> where the map object should be initialized as far as I can see?
>>
>> I can't see the problem, can you pleas enlighten me here, on how and in
>> which order I correctly have to initialize the different objects?
>>
>> Thank you very much
>> Christian
>>
>>
>> On 20.01.2011 17:42, geographika wrote:
>>> Hi,
>>>
>>> Do you have FireBug installed for FireFox?
>>> The reason your layout is breaking is due to a JavaScript error:
>>>
>>> layer.map is null
>>> at: layer.map.addControl(selectControl);
>>> http://www.sfb806db.uni-koeln.de/irtg_webgis/libs/GeoExt/lib/GeoExt/widgets/grid/FeatureSelectionModel.js
>>>
>>>
>>> Your Sites layer has not been added to the map at this point, so the map
>>> property is null.
>>> Try adding your Sites layer to the map before you create your grid panel
>>> as in the GeoExt example.
>>>
>>> From the API documentation -
>>> http://www.geoext.org/lib/GeoExt/widgets/grid/FeatureSelectionModel.html
>>>
>>> layer
>>> OpenLayers.Layer.Vector The vector layer used for the creation of
>>> the select feature control, it must already be added to the map. If
>>> not provided, the layer bound to the grid's store, if any, will be used.
>>>
>>>
>>> Regards,
>>>
>>>
>>> Seth
>>>
>>> On 20/01/2011 17:26, Christian Willmes wrote:
>>>> Hi,
>>>>
>>>> I removed
>>>> /sm: new GeoExt.grid.FeatureSelectionModel(), /
>>>> from
>>>> /var Store = new GeoExt.data.FeatureStore({ /
>>>>
>>>> and uncommented the sm in the grid. This breaks the layout (broken
>>>> version now on the server).
>>>>
>>>> Does anyone have maybe a link to a similar app, where this
>>>> GeoExt.grid.FeatureSelectionModel() is implemented sucsessfully (other
>>>> than the feature-grid.html geoext example), from which I maybe could
>>>> learn?
>>>>
>>>> Thanks,
>>>> Christian
>>>>
>>>> On 20.01.2011 15:55, geographika wrote:
>>>>> Hi,
>>>>>
>>>>> I can't see anything in a brief look at the code.
>>>>>
>>>>> Your:
>>>>>
>>>>> /var Store = new GeoExt.data.FeatureStore({ /
>>>>>
>>>>> should not have a sm property:
>>>>>
>>>>> /sm: new GeoExt.grid.FeatureSelectionModel(), /
>>>>>
>>>>> The layout seems fine in IE and FF. Maybe uncomment the sm: in your grid
>>>>> so we can see what is happening.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Seth
>>>>>
>>>>> http://geographika.co.uk
>>>>>
>>>>> On 20/01/2011 13:50, Christian Willmes wrote:
>>>>>> Hi Seth,
>>>>>>
>>>>>> thank you for the tip with JSLint. It seems to be a very useful tool. I
>>>>>> cleaned up my code accordingly to the errors shown by JSLint.
>>>>>> But that did not solved the problem with the
>>>>>> GeoExt.grid.FeatureSelectionModel() breaking the layout.
>>>>>>
>>>>>> Any further tips/hints anyone?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Christian
>>>>>>
>>>>>> On 20.01.2011 12:09, geographika wrote:
>>>>>>> Hi Christian,
>>>>>>>
>>>>>>> Your sample site does not load in IE due to extra commas. Run your
>>>>>>> code
>>>>>>> throughhttp://www.jslint.com/ to find where these are.
>>>>>>> I've found breaking layouts in FF can often be caused by these.
>>>>>>> Regards,
>>>>>>>
>>>>>>> Seth
>>>>>>>
>>>>>>> http://geographika.co.uk
>>>>>>>
>>>>>>> On 20/01/2011 12:00, Christian Willmes wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> in the moment I try to connect a GeoExt.data.FeatureStore to a
>>>>>>>> Ext.grid.GridPanel using GeoExt.grid.FeatureSelectionModel() for
>>>>>>>> interaction.
>>>>>>>>
>>>>>>>> I am able to connect the FeatureStore to the GridPanel, but as soon
>>>>>>>> as I
>>>>>>>> add the FeatureSelectionModel, the complete PanelLayout is destroyed.
>>>>>>>>
>>>>>>>> This is the source of the GridPanel:
>>>>>>>>
>>>>>>>> var grid = new Ext.grid.GridPanel({
>>>>>>>> width: '100%',
>>>>>>>> height: 143,
>>>>>>>> viewConfig: {forceFit: true},
>>>>>>>> store: Store,
>>>>>>>> //sm: new GeoExt.grid.FeatureSelectionModel(),
>>>>>>>> cm: new Ext.grid.ColumnModel({
>>>>>>>> defaults: {
>>>>>>>> sortable: true
>>>>>>>> },
>>>>>>>> columns: [
>>>>>>>> {header: "Site", dataIndex: "site"},
>>>>>>>> {header: "Stage", dataIndex: "stage"},
>>>>>>>> {header: "Technocomplex", dataIndex: "technocomp"},
>>>>>>>> {header: "Method", dataIndex: "methode"},
>>>>>>>> {header: "Age (calbp)", dataIndex: "calbp"},
>>>>>>>> {header: "standard deviation", dataIndex: "std"},
>>>>>>>> {header: "Autor", dataIndex: "Autor"},
>>>>>>>> {header: "LabCode", dataIndex: "LabCode"}
>>>>>>>> ]
>>>>>>>> })
>>>>>>>> });
>>>>>>>>
>>>>>>>> You can find the complete application here:
>>>>>>>> http://www.sfb806db.uni-koeln.de/irtg_webgis/app-sent-to-geoext.html
>>>>>>>> (if
>>>>>>>> you may want to have a look at the complete source).
>>>>>>>>
>>>>>>>> If the "sm: new GeoExt.grid.FeatureSelectionModel()" is commented
>>>>>>>> out,
>>>>>>>> everything looks fine, see (The style rules for the data are just for
>>>>>>>> testing at the moment! ;)):
>>>>>>>>
>>>>>>>> http://www.sfb806db.uni-koeln.de/irtg_webgis/commented.png
>>>>>>>>
>>>>>>>> If I uncomment the "sm: new GeoExt.grid.FeatureSelectionModel()" it
>>>>>>>> breks the Layout see:
>>>>>>>>
>>>>>>>> http://www.sfb806db.uni-koeln.de/irtg_webgis/uncommented.png
>>>>>>>>
>>>>>>>> But I need to have the interaction between the Grid and the selected
>>>>>>>> features on the map, any hint or advice to get this is very
>>>>>>>> apreciatred!
>>>>>>>>
>>>>>>>> Thank you very much and best regards,
>>>>>>>> Christian
>>>>>>>>
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Users mailing list
>>>>>>> Users at geoext.org
>>>>>>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at geoext.org
>>>>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at geoext.org
>>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list