Hello,
for each row of a table, I'm maintaining an object (marker for a map).
Initially I loop through table rows and create my array of markers from 0 to
rowcount-1.
var infowindow = null;
var tm = this._bottomTable.getTableModel();
for (var i = 0; i < tm.getRowCount(); i++) {
var contentString = "some html info";
);
var point = new google.maps.LatLng(tm.getRowDataAsMap(i).LAT,
tm.getRowDataAsMap(i).LON);
var marker = new google.maps.Marker({
position: point,
map: _map_wf,
title : tm.getRowDataAsMap(i).LVEH,
html : contentString,
animation : null });
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(this.html);
infowindow.open(_map_wf,this);
});
this._current_pos_markers.push(marker);
}
this._bottomTable.resetSelection();
},
Then each time the user clicked on a row, I just display the object
corresponding to the clicked row (same index).
the problem is when the user sorts the table, the index of the selected row
no more corresponds to the index of the array I'm maintaining and so I
display a wrong object.
var that = this;
table.getSelectionModel().addListener("changeSelection", function()
{
table.getSelectionModel().iterateSelection(function(index)
{
// Pb here when sorted: index in markers array do not correspond to
the selected index
var marker = that._current_pos_markers[index];
var point = marker.getPosition();
var markerBounds = new google.maps.LatLngBounds();
markerBounds.extend(point);
_map_wf.fitBounds(markerBounds);
_map_wf.setCenter(point);
}
})
}
I wonder if somebody here knows an efficient way to handle such situation,
like attaching each object to the corresponding row or is there another
hidden index that stay the same even if the table is sorted. I'm running out
of ideas :)
Best Regards
--
View this message in context:
http://qooxdoo.678.n2.nabble.com/attaching-a-userdata-to-a-table-row-tp6306120p6306120.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel