Jump to content

Archived

This topic is now archived and is closed to further replies.

litebearer

BaaGrid - editable records

Recommended Posts

Good Morning!

I have downloaded and begun to experiment with baaGrid (great 'script'! and easy to make it do most of what I need).

Retrieving and display the data desired is quick and easy; however, I have a need to be able to display the grid as editable 'records/fields' [ie add/edit/delete].

I was hoping our mentor Barand (who tho he may be approaching senility is still younger than me) might shed some light (no pun on my name intended) in the fashion of the '** For Dummies' series.

(btw this is for a project to be used to encourage children k - 12 to read)

Thanks Much,

Lite
(nick)

Share this post


Link to post
Share on other sites
I'm not quite sure why you're posting instead of emailing him.  Also, if you want to make the grid editable, I'm not sure how that has anything to do with his scripts.  That is functionality beyond what he has provided and should be directed to those who can help with code you might have already begun to work with.

Share this post


Link to post
Share on other sites
I've just seen this post. There is an example using checkboxes with class. Currently it's not an inbuilt feature but you could do

[code]
<?php
include 'db.php';
include 'baagrid.php';

if (isset ($_GET['action'])) {
    echo '<pre>', print_r($_GET, true), '</pre>';
}

$sql = "SELECT id, locname, qty FROM baagriddata";
$grid = new baaGrid($sql);
echo '<form>';
$grid->setGPCol (1, "<input type='text' size = '15' name='locname[#0]' value='#1'>");
$grid->setGPCol (2, "<input type='text' size = '5' name='qty[#0]' value='#2'>");
$grid->display();
echo '<input type="submit" name="action" value="Submit">' ;
echo '</form>';
?>
[/code]

Share this post


Link to post
Share on other sites
... or this, which lets you select an individual line to edit

[code]
<?php
include 'db.php';
include 'baagrid.php';

if (isset ($_GET['action'])) {
    echo '<pre>', print_r($_GET, true), '</pre>';
}

function formField ($name, $size, $value, $id) {
    if ($id == $_GET['editid'])
        return "<input type='hidden' name='id' value='$id'>
                <input type='text' size = '$size' name='$name' value='$value'>";
    else
        return $value;
}

$sql = "SELECT id, locname, qty, 'edit' as Edit FROM baagriddata";
$grid = new baaGrid($sql);
echo '<form>';
$grid->setGPCol (1, "formField('locname',15,#1, #0)");
$grid->setGPCol (2, "formField('qty',5,#2, #0)");
$grid->setLink(3,"$_SERVER[PHP_SELF]?editid=#0");
$grid->showErrors();
$grid->display();
echo '<input type="submit" name="action" value="Submit">' ;
echo '</form>';

?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.