dhtmlxDataView data.getSelected() method is not returnig id

Hi

dhtmlxDataView data.getSelected() method is not returnig id correctly…, on first click it is returning id of previously selected item…, if no item was selected previously it is returning null on first click…,Please provide a way to return id

Regards
Seenu

Hi,

There are selected events that occurs on item click:
onClick
onBeforeSelect
onAfterSelect

getSelected() returns clicked item from in the onAfterSelect handler, in other events selected id is not changed yet.

In any case, you may get clicked id after event handler arguments:

dataview.attachEvent(“onAfterSelect”,function(id){
alert(id);
});

Hi…

I want to get the id of item when i click the image shown in the attachement…, when im using data.getSelected() in onClick action of image it is not returning correctly…, how can i get correct id…please help me out…


Hi,

possibly 1ms timeout will help:

window.setTimeout(function(){
var id = view.getSelected();
},1)

hi…

No…, it is returning the same as previous…

You may set on_click event listenter for dataview elements with a certain css class:

[code]dataview = new dhtmlXDataView({
type:{
template:"some content ",
height:40
},

});

dataview.on_click[“my_image”] = function(e){
var id = this.locate(e);
/your code here/
}[/code]