[英]reload page and go to previously active tab php jquery-jtable
I want to reload the page and navigate to the user's previously active tab after the user has clicked the submit
button on a jquery-jtable
form. 我想重新加载页面,并导航到用户先前激活的标签用户点击后
submit
一个按钮jquery-jtable
形式。 What I have now reloads the page but doesn't navigate to the user's last active tab before the reload. 现在,我已经重新加载了页面,但是在重新加载之前没有导航到用户的最后一个活动选项卡。 The tabs are created using
jquery ui
. 使用
jquery ui
创建选项卡。 Here's the shortened html: 这是缩短的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');
}
I tired location.href = config.base_url + '#tabs-Lessons-Learned';
我累了
location.href = config.base_url + '#tabs-Lessons-Learned';
but that didn't work. 但这没用。 Most working solutions that I found online were for bootstrap so they weren't of much help.
我在网上找到的大多数有效解决方案都是用于引导程序的,因此它们并没有太大帮助。
I found this question on stackoveflow but I wasn't able to tailor the answer to my needs. 我在stackoveflow上发现了这个问题,但是我无法根据自己的需要定制答案。
All help is greatly appreciated. 非常感谢所有帮助。
Instead of location.reload(true);
代替
location.reload(true);
I used loaction.assign('address_I_wanted_to_go_to')
我用了
loaction.assign('address_I_wanted_to_go_to')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.