簡體   English   中英

重新加載頁面並轉到先前活動的選項卡php jquery-jtable

[英]reload page and go to previously active tab php jquery-jtable

我想重新加載頁面,並導航到用戶先前激活的標簽用戶點擊后submit一個按鈕jquery-jtable形式。 現在,我已經重新加載了頁面,但是在重新加載之前沒有導航到用戶的最后一個活動選項卡。 使用jquery ui創建選項卡。 這是縮短的html:

    <div id="tabs">
            <ul>
                <li><a href='#tabs-TasksWithRisks'>Tasks With Risks</a></li>
                <li><a href='#tabs-Lessons-Learned'>Lessons Learned</a></li>
            </ul>

           <div id='tabs-TasksWithRisks' class='tab'>
                <div id="TasksWithRisksTableContainer" class="jTableContainer" style="width:100%;"></div>
            </div>
            <div id='tabs-Lessons-Learned' class='tab'>
                <div id="LessonsLearnedTableContainer" class="jTableContainer" style="width:100%;"></div>
            </div>            
     </div>

<script type="text/javascript">
    var project_id = <?php echo $project_data['project_id']; ?>;
    var modify = <?php echo $modify ? 'true' : 'false'; ?>;
    $(document).ready(function() {
        loadViewProjectTasksWithRisksTable('TasksWithRisksTableContainer', project_id, modify);
        loadViewLessonsLearnedTable('LessonsLearnedTableContainer', project_id, modify);
</script>

function loadViewLessonsLearnedTable(ContainerID, project_id, modify, no_toolbar) {
    var fields = $.extend(true, fields, LessonsLearnedFields); //copy, don't reference
    fields.Responses = getLessonsLearnedResponseChildTable(ContainerID);
    $('#' + ContainerID).jtable({
        title: 'Lessons Learned',
        paging: true,
        pageSize: 100,
        sorting: true,
        defaultSorting: 'WBS ASC',
        actions: {
            listAction: config.base_url + 'data_fetch/risks_cause_by_project/' + project_id,
            deleteAction: config.base_url + 'data_fetch/delete_risk/',
            updateAction: config.base_url + 'data_fetch/update_lessons_learned_risk/' + project_id 
        },
        messages: defaultRiskMessages,
        fields: fields,        ,
        formSubmitting: function(event,data){
            $('select[name=cause]', data.form).attr('name','cause[]');
            location.reload(true);
            return data;
        }
    });
    $('#' + ContainerID).jtable('load');
}

我累了location.href = config.base_url + '#tabs-Lessons-Learned'; 但這沒用。 我在網上找到的大多數有效解決方案都是用於引導程序的,因此它們並沒有太大幫助。

在stackoveflow上發現了這個問題,但是我無法根據自己的需要定制答案。

非常感謝所有幫助。

代替location.reload(true); 我用了loaction.assign('address_I_wanted_to_go_to')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM