Edit ApPHP data grid in tabs [Solved]

Discuss everything related to ApPHP Tabs. Any questions related to the ApPHP Tabs developing or using should be posted to this forum.

Moderators: alexandrleonenko, Milton

cphil123
Junior
Junior
Posts: 24
Joined: Mar 28th, '11, 11:23
Location: Belgique

Re: Edit ApPHP data grid in tabs

Postby cphil123 » Jul 25th, '11, 11:33

Hello,

I also have the same problem when I edit a files tab 2, the page will automatically put the tab No. 1 without being able to make changes!

do you have a solution? datagrid opens the pages very well, I can edit a file in tab # 1 ...


here is the code :

Code: Select all

<?php
session_start();
## +---------------------------------------------------------------------------
## | 1. Creating & Calling:                                                    |
## +---------------------------------------------------------------------------
## *** define a relative (virtual) path to tabs.class.php file
define ("TABS_DIR", "../modules/tabs/");                /* Ex.: "tabs/" */
## *** include Tabs class
require_once(TABS_DIR."tabs.class.php");
require_once("../inc/classes/session.class.php");   
require_once("../inc/checkAdminPagePermissions.php");
## *** create Tabs object
/* $tabid = isset($_GET['tabid']) ? $_GET['tabid'] : "1_1";  */
$tabs = new Tabs("");
 
## +---------------------------------------------------------------------------
## | 2. General Settings:                                                      |
## +---------------------------------------------------------------------------
## *** set unique numeric (integer-valued) identifier for Tabs
## *** (if you want to use several independently configured Tabs objects on single page)
$tabs->SetId(1);
##  *** set style for Tabs
##  *** "xp", "dark-pink", "light-green", "g-style", "grey" or your own style
$tabs->SetStyle("g-style");
## *** set Tabs caption
$tabs->SetCaption("Gestion des Véhicules");
## *** show debug info - false|true
$tabs->Debug(true);
## *** choose mode of displaying child tabs - links|dropdown|tabs
$tabs->SetChildTabsType("tabs");
## *** set form submission type: "get", "post" or "ajax"
$tabs->SetSubmissionType("get");
## *** set variables that used to get access to the page (like: my_page.php?act=34&id=56 etc.)
$tabs->SetHttpVars(array("id"));
##  *** allow refreshing selected tabs
$tabs->AllowRefreshSelectedTabs(true);
## *** use an anchor to navigate to tabs object after a tab is clicked - true|false
$tabs->UseAnchor(true);
## *** create the anchor automatically - true|false
$tabs->CreateAnchorAuto(true);
## *** if the CreateAnchorAuto is set to true you have to create the anchor manually
/// <a name='tabs'></a>
 
## +---------------------------------------------------------------------------
## | 3. Adding tabs:                                                           |
## +---------------------------------------------------------------------------
## *** add tabs
## arguments:
## arg #1 - tab's caption
## arg #2 - file associated with this tab (optional)
## arg #3 - icon associated with this tab (optional)
## arg #4 - tab's tooltip
## Example 1: $tabs->AddTab("Title");
## Example 2: $tabs->AddTab("Title", "text.txt");
## Example 3: $tabs->AddTab("Title", "text.txt", "icon.gif");
## Example 4: $tabs->AddTab("Title", "text.txt", "icon.gif", "tooltip");
 
$son = $tabs->AddTab("Tracteurs","vehicules/tracteurs.php");
$son2 = $tabs->AddTab("Remorques","vehicules/remorques.php");
$son3 = $tabs->AddTab("Voitures");
$son4 = $tabs->AddTab("Autres");


/* $grandson1=$son->AddTab("Grandson's Title #1");
$grandson2=$son->AddTab("Grandson's Title #2", "examples/code.php"); */
 
## *** associate a tab with HTML code snippet:
/* $son->SetInnerHTML("");
$son2->SetInnerHTML("<b><i><span onclick='alert("How do you do?")'>HTML</span></i> code snippet</b>"); */
 
## *** open a tab in a new window
/// $grandson2->OpenNewWindow(true);
 
## *** set a tooltip for a tab
/* $son->SetTooltip("Child tab's tooltip"); */

## +---------------------------------------------------------------------------
## | 4. Display Settings:                                                      |
## +---------------------------------------------------------------------------
## *** set container's width
## *** for example "200px" or "40%" or "auto" (default)
$tabs->SetWidth("auto");
 
## *** set container's height
## *** for example "200px" or "auto" (default)
$tabs->SetHeight("auto");
 
## +---------------------------------------------------------------------------
+## | 5. Disabling Tabs:                                                        |
## +---------------------------------------------------------------------------
/// $grandson2->Disable();
 
## +---------------------------------------------------------------------------
+## | 6. Choosing tabs which will be selected by default:                       |
## +---------------------------------------------------------------------------
/// $tabs->SetDefaultTab($son);
/// $son->SetDefaultTab($grandson2);
 
## +---------------------------------------------------------------------------
+## | 7. Draw Tabs:                                                             |
## +---------------------------------------------------------------------------

$tabs->Display();

## +---------------------------------------------------------------------------+
 ?>

Buzz Brown
Senior
Senior
Posts: 41
Joined: Apr 18th, '10, 09:47
Location: Auburn Hills, MI

Re: Edit ApPHP data grid in tabs

Postby Buzz Brown » Jul 25th, '11, 12:20

I have not solved this yet. I am hoping ApPHP will figure out a solution. They keep asking for samples for something that seems so obvious to recreate. My databases are password protected and I don't have the time to build an open database and sample pages to illustrate the problem any further. Actually, they have the same problem with DataGrid itself; that is the lack of an anchor point. ApPHP responded that this will be added to the next release of the DataGrid. For example, if you have a long page with a grid at the bottom and click EDIT, ADD or DETAILS buttons, the page refreshes and puts you back at the top again.

cphil123
Junior
Junior
Posts: 24
Joined: Mar 28th, '11, 11:23
Location: Belgique

Re: Edit ApPHP data grid in tabs

Postby cphil123 » Jul 25th, '11, 14:05

hello, thank you for the message, we will wait a new version or I'll see if it is not possible to put the anchor point in the datagrid ...
Philippe

administrator
Site Admin
Site Admin
Posts: 6009
Joined: Jan 7th, '09, 23:18
Contact:

Re: Edit ApPHP data grid in tabs

Postby administrator » Jul 25th, '11, 15:43

such feature is planned to be added in the next version of datagrid, but it already exists in Tabs.

Code: Select all

## *** use an anchor to navigate to tabs object after a tab is clicked - true|false
$tabs->UseAnchor(true);
## *** create the anchor automatically - true|false
$tabs->CreateAnchorAuto(true);
## *** if the CreateAnchorAuto is set to true you have to create the anchor manually
/// <a name='tabs'></a>

Buzz Brown
Senior
Senior
Posts: 41
Joined: Apr 18th, '10, 09:47
Location: Auburn Hills, MI

Re: Edit ApPHP data grid in tabs

Postby Buzz Brown » Jul 25th, '11, 16:23

If i understand how AutoTab works I don't believe this solves the problem. We don't know which tab will be the default until the user clicks an edit button on the grid. For example, if the users clicks edit on the grid that is on Tab #5 then Tab #5 is the default. If the user clicks the edit button on Tab #3 then tab Number is the default.

administrator
Site Admin
Site Admin
Posts: 6009
Joined: Jan 7th, '09, 23:18
Contact:

Re: Edit ApPHP data grid in tabs

Postby administrator » Jul 26th, '11, 08:03

Ok, seems it can be fixed by using following feature of datagrid:

$http_get_vars = array("tabid");
$dgrid->setHttpGetVars($http_get_vars);

This will allow for datagrid to store selected Tab between changing of modes.

Buzz Brown
Senior
Senior
Posts: 41
Joined: Apr 18th, '10, 09:47
Location: Auburn Hills, MI

Re: Edit ApPHP data grid in tabs [SOLVED]

Postby Buzz Brown » Jan 2nd, '12, 12:16

This solves the problem nicely. I have tried this on several examples using multiple grids on different tabs. I can add, edit and delete data in the grids while remaining within the proper tab.

$http_get_vars = array("tabid");
$dgrid->setHttpGetVars($http_get_vars);

Thanks

ceremonychap
Junior
Junior
Posts: 13
Joined: Jul 5th, '11, 15:58

Re: Edit ApPHP data grid in tabs

Postby ceremonychap » Aug 7th, '13, 05:36

Where do I put these two statements.

$http_get_vars = array("tabid");
$dgrid->setHttpGetVars($http_get_vars);

Could I have an example?

administrator
Site Admin
Site Admin
Posts: 6009
Joined: Jan 7th, '09, 23:18
Contact:

Re: Edit ApPHP data grid in tabs

Postby administrator » Aug 7th, '13, 08:24

This is a part of datagrid code.

ceremonychap
Junior
Junior
Posts: 13
Joined: Jul 5th, '11, 15:58

Re: Edit ApPHP data grid in tabs

Postby ceremonychap » Aug 8th, '13, 05:01

I've found the two statements in datagrid. I've uncommented. I am still missing something, What else do I need? to make it work. If there any example that I can study?
By the way I am on DataGrid v7.7.7.

Thank


Return to “ApPHP Tabs”