PDA

View Full Version : Cannot get selected item in grid



maecy
28 Nov 2013, 10:13 PM
I cannot get the data from the selected grid cell. It was working before, I didn't change any of my code inside the method but I keep getting this error:

47050

Here's my createPlaylist method where I get the error:


createPlaylist:function(record){ var scope = this;
var vo = record;
var sel = scope.getShowImages().getSelectionModel().getSelection();
var user = scope.getProfinfo().getForm().getValues();
var filename = sel[0].data.filename;
var imageid = sel[0].data.image_id;
var ref_num = sel[0].data.ref_num;
var transition = scope.getTransitions().getValue();
var time = scope.getTime().getValue();
var date = new Date();
var playlistid = scope.getRndInt().getValue();
var sel2 = scope.getTerminalGrid().getSelectionModel().getSelection();
var terminals = sel2[0].data;



Ext.Service.invoke(
'PlaylistManager',
'saveplaylistdetails',
[user.id,filename,imageid,transition,time,date,playlistid,ref_num],
function(p){
console.log('eto ang p',p)
if(p.success){
Ext.Msg.alert('dlti', p.result[0].message);
scope.getPlaylistDetailsGrid().show();
scope.getTransitions().reset();
scope.getTime().reset();


scope.getAllowedtime().setValue(terminals.num_of_spots*30);
var staytime = scope.getAllowedtime().getValue();
scope.getTime().setMaxValue(staytime);

Ext.Service.invoke(
'PlaylistManager',
'getstaytime',
[user.id,imageid,playlistid],
function(p1){
scope.getAccumulatedtime().setValue(p1.result);
var totalacc = scope.getAccumulatedtime().getValue();
var totalavl = staytime - totalacc;
scope.getTime().setMaxValue(totalavl);
scope.getTotalAvailabletime().setValue(totalavl);
scope.getThumbnailPopup().hide();
}
);

}else{
//scope.getThumbnailPopup().hide();
Ext.Msg.alert('Error', 'Please check your inputs.');
scope.getPlaylistDetailsGrid.show();
}



});

},

Could anyone please help me find the error?

xjscrafter
29 Nov 2013, 5:15 AM
So it seems this line is not returning the selection:


var sel = scope.getShowImages().getSelectionModel().getSelection();


You say this was working before and no code has changed. How about your steps to reproduce, are you doing anything differently?

maecy
1 Dec 2013, 4:42 AM
What do you mean in my steps to reproduce?

xjscrafter
1 Dec 2013, 8:59 AM
You say it was working before, and now its not working, but you didn't change anything. Sometimes this can happen if what we do in the UI is slightly different. That is what I mean by steps to reproduce. Are you doing exactly the same thing in the UI? If so, could this be a caching problem?

maecy
1 Dec 2013, 5:25 PM
Yes. It's the same as the UI. I really have no idea. I tried to replace my codes with the old one (my backup) but it returns the same error.