【发布时间】:2013-05-24 22:06:07
【问题描述】:
我正在使用 Solr 4.3.0 并为接口实现 Ajax-Solr。但是,Ajax-Solr 不会自动保存状态。有一个 ParameterStore 和 ParameterHashStore 方法,但它们不适用于旧版浏览器。我使用了我的 google-fu 并发现以下内容,但它没有按预期工作:
https://github.com/evolvingweb/ajax-solr/pull/23
...我想出了更多资源:
<script>
var Manager;
(function ($) {
Manager.setStore(new AjaxSolr.ParameterHashStore());
Manager.store.exposed = [ 'fq', 'q', 'start' ];
Manager.init();
// Establish Variables
var History = window.History; // Note: We are using a capital H instead of a lower h
if ( !History.enabled ) {
// History.js is disabled for this browser.
// This is because we can optionally choose to support HTML4 browsers or not.
return false;
}
State = History.getState(),
// Bind to State Change
History.Adapter.bind(window,'statechange',function(){ // Note: We are using
statechange instead of popstate
// Log the State
var State = History.getState(); // Note: We are using History.getState() instead
of event.state
History.log('statechange:', State.data, State.title, State.url);
});
// Log Initial State
History.log('initial:', State.data, State.title, State.url);
})(jQuery);
</script>
但它不起作用。所有浏览器中的前进和后退按钮都已损坏,并且没有任何内容记录到控制台。
我缺少什么或者 v4.3.0 现在本身就很无聊并且需要补丁?
非常感谢任何帮助。谢谢!
【问题讨论】:
-
另外,我忘了提到即使我添加了 Manager.store.exposed 代码,Ajax-Solr 也不会公开 URL 参数
标签: javascript ajax apache solr history.js