Opened 7 years ago

Last modified 6 years ago

#402 new defect

incorrect reordering in LayerStore

Reported by: pgiraud Owned by:
Priority: major Milestone: 1.2
Component: GeoExt.data.LayerStore Version: 1.0
Keywords: Cc:
State: Needs more work

Description

In the cases where the layers list in the map doesn't exactly match the records list in the store (for example, when the store is only a subset of map layers), the onChangeLayer reordering is not correctly done because it is based on map layers index.

Attached is a patch which reorders all the store to match the map layers order even if we consider only a subset. To be honest, I'm not completely confident with this patch though I spent a lot of time on it.

The patch also tries to simplify some tests. Testing that we have 3 items in a store, then test the first and the second one is enough, in my opinion. We don't need to have a test for the third one. Also some comments were wrong.

Attachments (1)

patch_geoext_layerstore.diff (8.7 KB) - added by pgiraud 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by pgiraud

comment:1 Changed 7 years ago by pgiraud

  • State changed from Review to Needs more work

The reason why I wasn't confident is that I don't think removing/adding records in the store to simply reorder them is probably not the best way to do it. Ideally, we could define a function as a sorter for the store. Unfortunately, !ExtJS doesn't provide any method or config option for that. One other solution I would like to have a try soon would be to add a new field in the records. The value of this field would represent the layer index in the map. Changing a layer order in the map, would modify the value of the corresponding record in the store. We would simply have to sort by the given field. In case components have to be informed that the order changed, they listen to the "datachanged" event on the store and they're done.

comment:2 Changed 6 years ago by ahocevar

  • Milestone changed from 1.1 to 1.2

Batch move of tickets to finish the 1.1 milestone.

Note: See TracTickets for help on using tickets.