Hello,
I have a results page with different widgets (tagclouds, navigation, results...)
The result content is an html table displaying some solr fields. I want to display some detail content when a double click is performed in one row.
For this purpose i followed this example
https://github.com/evolvingweb/ajax-solr/wiki/Tutorial%3A-Send-a-Solr-request-without-updating-widgets
The code to make rows selectable is the following
$(table).selectable({
filter:'tr',
selected: function(event, ui){
var newstore = new AjaxSolr.ParameterStore();
newstore.addByValue('fq', 'systemname' + ':' + ui.selected.id);
newstore.addByValue('q', '*:*');
newstore.addByValue('group', true);
newstore.addByValue('group.field', ['element_type']);
newstore.addByValue('group.ngroups', true);
newstore.addByValue('group.limit', 1000);
newstore.addByValue('json.nl', 'map');
newstore.addByValue('sort', 'systemname asc');
self.manager.executeRequest('select', newstore.string(), function (data) {
self.manager.widgets['detailResult'].afterRequest(data);
});
}
});
self.manager.widgets['detailResult'] is a custom widget with a method that process data parameter instead process manager.response value
afterRequest: function (data) {
if (data){
$(this.target).empty();
for (var i = 0, l = data.grouped[this.group_field].groups.length; i < l; i++) {
var table = $('<table class="confluenceTable" style="margin-top:0px"><tbody></tbody></table>');
$(this.target).append(table);
$(table).append('<tr><th class="confluenceTh">Name</th><th class="confluenceTh">Type</th><th class="confluenceTh">Arch</th><th class="confluenceTh">Date</th><th class="confluenceTh">Time</th><th class="confluenceTh">Lic Exp</th><th class="confluenceTh">Message Srv</th><th class="confluenceTh">Installation Number</th><th class="confluenceTh">TMS Domain</th></tr>');
for (var j = 0, m = data.grouped[this.group_field].groups[i].doclist.docs.length; j < m; j++) {
var doc = data.grouped[this.group_field].groups[i].doclist.docs[j];
var first = j==0;
if (data.grouped[this.group_field].groups[i].doclist.docs.length>1){
$(table).append(this.template(doc,data.grouped[this.group_field].groups[i].doclist.docs.length,first));
}
else $(table).append(this.template(doc));
var items = [];
items = items.concat(this.facetLinks('architecture', doc.architecture));
items = items.concat(this.facetLinks('systemtype', doc.systemtype));
items = items.concat(this.facetLinks('element_type', doc.element_type));
var $links = $('#links_' + doc.id);
$links.empty();
for (var k = 0, itemsL = items.length; k < itemsL; k++) {
$links.append($('<li></li>').append(items[k]));
}
}
}
}
The problem i'm experiencing resides the block
var newstore = new AjaxSolr.ParameterStore();
newstore.addByValue('fq', 'systemname' + ':' + ui.selected.id);
newstore.addByValue('q', '*:*');
newstore.addByValue('group', true);
newstore.addByValue('group.field', ['element_type']);
newstore.addByValue('group.ngroups', true);
newstore.addByValue('group.limit', 1000);
newstore.addByValue('json.nl', 'map');
newstore.addByValue('sort', 'systemname asc');
self.manager.executeRequest('select', newstore.string(), function (data) {
self.manager.widgets['detailResult'].afterRequest(data);
});
where the new ParameterStore seems to see the same to the manager.store
- After instantiation the values are the same than manager.store ones
- When i modify newstore, further calls to manager.doRequest in the default way seems to have the parameters specified for newstore ...
Any idea???