I'm currently trying to find out, how to get a reference to currently selected list in sharepoint from javascript. I can get it if I know the title, or id, but I want it to get the list dynamically depending on where the user is. I have this code (in my modal dialog):
ExecuteOrDelayUntilScriptLoaded(init, 'sp.js');
function init() {
var context = SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getById(SP.ListOperation.Selection.getSelectedList());
}
The problem is that SP.ListOperation.Selection.getSelectedList()
returns null. There is probably some other script I need to wait for - but which one?