I'm creating a web part with some ListView inside.. I tried in many ways to "connect" the javascript SP.ListOperation.Selection.getSelectedItems to my ListView, but it won't work.. With the ListView inserted with the ootb tool no problem, with mine (same base lists) doesn't work!
Here's some code: JS:
<script type"text/javascript">
function GetSelectedDocuments() {
alert('INIZIO');
var clientContext = new SP.ClientContext.get_current();
this.oWebsite = clientContext.get_web();
clientContext.load(oWebsite);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
alert('Query OK');
var items = SP.ListOperation.Selection.getSelectedItems(ctx);
var myItems = '';
var k;
// Loop through items
for (k in items) {
myItems += items[k].id + ",";
alert('ID: ' + items[k].id);
}
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
</script>
<br/>
And the ascx:
<SharePoint:ListView runat="server" ID="listViewClienti" Visible="false" ListID="{54BA6A4E-917D-427B-B488-60FB41196C38}" View="{15ECCE7F-DD9C-4519-992A-757BDD1E8AB4}" />
The list is well showed, but the SP.ListOperation.Selection cannot get the selected items when invoked.. I tried also with xsltview and other controller...
Do i miss anything to make MY listview equals to the one "sharepoint ootb inserted"?
Thank you very much (sorry for the english but i'm trying to fix this problem from about 15hours!)