Tags:
create new tag
view all tags

SID-02141: using edittable within jqtabpane

Status: Answered Answered TWiki version: Perl version:
Category: JQueryPlugin Server OS: CentOS 5.2 Last update: 6 years ago

I have setup tabs on my topic using jqtabpane jqtab. Within my tabs I have tables which I have made to be editable by using edittable.

The problem I'm having, is that when you click on the edit button of the table in any tab that is not the first tab, the page refreshes and returns to the first tab. If you navigate back to your tab, the table is ready to edit.

My question: Is it possible, that after a user clicks on edit to edit a table in the 3rd tab, that after the page refreshes it returns to that 3rd tab?

Sample of my code below between jqtab variables:

%TABLE{ sort="off" tablerules="all" tableborder="1" cellpadding="4" cellspacing="3" cellborder="1" headerrows="1"}%
%EDITTABLE{ format="| select, 1, Select Branch, %FORMFIELD{"OPS Branch Code"}%, %FORMFIELD{"Sat OPS Branch Code"}%, %FORMFIELD{"Sat2 OPS Branch Code"}%, %FORMFIELD{"Sat3 OPS Branch Code"}% | text, 50 | label, 0, %USERNAME% | label, 0, %SERVERTIME{"$day $mon $year $hour:$min"}% |" changerows="on" editbutton="Click here to enter comment"}%
| *Branch Location* | *Comment* | *User* | *Date & Time Entered* |

-- Christopher Crowe - 2015-12-31

Discussion and Answer

That is a bit tricky. Fortunately, the TABPANE offers a select="" parameter to control the active tab, and the EDITTABLE emits a hidden ettablenr URL parameter in POST on edit. You can tie that together with a CALCULATE.

Test JQTABPANE and EDITTABLE in Tab 2:

Tab 1

Blah 1

Tab 2

Blah 2

Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6
Cell 7 Cell 8 Cell 9

Tab 3

Blah 3

Tab 4

Blah 4

TABPANE with CALCULATE formula:
%JQTABPANE{ select="%CALCULATE{$IF($EXACT(%URLPARAM{ettablenr}%, 1), 2, 1)}%" }%

  • test for URL parameter ettablenr,
  • if 1 (e.g. first EDITTABLE), select tab 2,
  • else select tab 1

Details in JQueryPlugin, VarJQTABPANE, VarURLPARAM, VarCALCULATE

-- Peter Thoeny - 2016-01-02

Hi Peter,

Happy New Years and thanks for answering this.

This is definitely going in the right direction but not quite working. When I enter the select=" " parameter it seems to work the reverse from your example. When I edit a table in tab 1, it refreshed and returns to tab 2. When I edit a table in tab 2, it refreshes and returns to tab 1. I can change the "... 1), 2, 1)" around to get it to work right, but that tells me something may not be working correctly. I had to change it to "... 2), 2, 1)"

How to get it working for all tabs? I have 9 Tabs, each with an EDITTABLE that I would need to have returned to the tab in which the edit button was clicked. I tried to add more to the $IF statement, but any changes I made seem to break the page.

-- Christopher Crowe - 2016-01-04

If you have a predictable sequence of tabs and edit tables you simply feed the proper ettablenr to the select. Untested:

select="%CALCULATE{$MAX(1, %URLPARAM{ettablenr}%)}%"

-- Peter Thoeny - 2016-01-05

That worked perfect!

--*Example Return to correct tab after using EDITABLE "Edit"*

Tab 1

Blah 1

Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6
Cell 7 Cell 8 Cell 9

Tab 2

Blah 2

Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6
Cell 7 Cell 8 Cell 9

Tab 3

Blah 3

Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6
Cell 7 Cell 8 Cell 9
     

Tab 4

Blah 4

Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6
Cell 7 Cell 8 Cell 9

-- Christopher Crowe - 2016-01-05

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title using edittable within jqtabpane
SupportCategory JQueryPlugin
TWiki version

Server OS CentOS 5.2
Web server Apache/2.0.52
Perl version

Browser & version IE 11 / Chrome 45.0.2454.101 m
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2019-07-17 - TWikiGuest
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.