EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rezzonico on February 08, 2019, 02:29:30 AM



Title: Using easyui offline
Post by: rezzonico on February 08, 2019, 02:29:30 AM
Hi all,

I am writing a small application that must run offline.

Therefore I have added the following directive:
<html manifest="index.appcache">

The following example works:
https://www.ofima.ch/PPP.6/index1.html

But if the tab content is loaded with "href", when you select "tab2" a loading message appears and the tab content is not updated.
See the following example:
https://www.ofima.ch/PPP.6/index2.html


I am not sure but the reason could be that the "href" dynamically adds some code like "?_=1549621105203".


Thanks for any help.
Miche



Title: Re: Using easyui offline
Post by: stworthy on February 10, 2019, 07:52:28 AM
This line '?_=1549621105203' is appended by jQuery when calling $.ajax with 'cache' set to false. To remove this line, please custom the 'loader' function for each tab panel.
Code:
<script type="text/javascript">
function myloader(param, success, error){
var opts = $(this).panel('options');
if (!opts.href){return false}
$.ajax({
type: opts.method,
url: opts.href,
cache: true,
data: param,
dataType: 'html',
success: function(data){
success(data);
},
error: function(){
error.apply(this, arguments);
}
});
}

</script>
<div id="tt" class="easyui-tabs" style="width:500px;height:250px;">
<div title="Tab1" href="tab1.html" data-options="loader:myloader">
</div>
<div title="Tab2"  href="tab2.html" data-options="loader:myloader">
</div>
</div>


Title: Re: Using easyui offline
Post by: rezzonico on February 12, 2019, 09:57:14 AM
Thanks a lot !

Miche