を別のタブパネルに表示したいホストされたWebページを読み込む簡単なアプリがあります。これを行う最もクリーンな方法は何ですか? ユーザーが各タブをクリックするとタブが読み込まれる可能性があります。または、アプリの起動時にすべてが一度に読み込まれる可能性があります。 Sencha Touchには単にhtml:valueをURLにする方法はありません。各タブにページロードイベントを追加できますか?外部URLをタブパネルに読み込む
[更新]
私は初期にAjaxの呼び出しを行うために提案を追加しました:メソッドを、テストのためにローカルのHTMLファイルを使用して。ただし、すべてのタブには完了する最初のAjax結果が表示されます。
このコードは現在完全に機能しています。私は忘れてしまった:this.callParent(引数);
私はこの例をSenchaFiddleに置いています。最初の2つのタブは、ajax呼び出しが失敗するためロードされませんが、最後の2つのComponentQueryが機能します。
ここでは画面がどのように見えるべきかのアイデアです:
Ext.define('SenchaFiddle.view.MainView', { extend: 'Ext.tab.Panel', config: { tabBarPosition:'bottom', layout: { type: 'card', animation: { duration: 300, easing: 'ease-in-out', type: 'slide', direction: 'left' } }, fullscreen: true, items: [ { title: 'Top Stories', iconCls: 'info', xtype: 'panel', items: [ { title: 'Top Stories', xtype: 'toolbar', docked: 'top' }, { id: 'image-tab', html: 'Loading top stories url...' } ] }, { title: 'Entertainment', iconCls: 'action', items: [ { title: 'Entertainment', xtype: 'toolbar', docked: 'top' }, { id: 'news-tab', html: 'Loading entertainment url...' } ] }, { id: 'tab3', title: 'Sports', iconCls: 'user' }, { id: 'tab4', title: 'Science', iconCls: 'star' } ] }, initialize: function() { console.log("View initialized"); Ext.Ajax.request({ url: 'bar.html', // you must have access to the server method: 'GET', callback: function(options, success, response) { console.log(response.responseText); Ext.ComponentQuery.query('#image-tab')[0].setHtml(response.responseText); } }); Ext.Ajax.request({ url: 'foo.html', // you must have access to the server method: 'GET', callback: function(options, success, response) { console.log(response.responseText); Ext.ComponentQuery.query('#news-tab')[0].setHtml(response.responseText); } }); Ext.ComponentQuery.query('#tab3')[0].setHtml("boom"); Ext.ComponentQuery.query('#tab4')[0].setHtml("bang"); this.callParent(arguments); // Don't forget this! } });
:
をここで基本的なビューがあります
内容でbar.html
<p style="color: #0f0;"> bar </p>
これらのタブにすべてリストを表示しますか? –