kgrogers

Forum Replies Created

Viewing 15 replies - 1 through 15 (of 40 total)
  • Author
    Replies
  • in reply to: Adding Rows and Searching with foriegn keys #128203
    kgrogers
    Participant

    Will:

     

    I see now where I went wrong on my last iteration – I changed the SelectCommand per your examples and my grid is now behaving correctly.

     

    Thank you so much for your diligence and support.

     

    Ken

    in reply to: Adding Rows and Searching with foriegn keys #128199
    kgrogers
    Participant

    Will:

    So the original SQL I submitted is the same as in your last message – the only change you suggested is to flip the formatter option to true in the setSelect statement – is that correct?

     

    When I made those changes the CustomerFullName and Status columns in the grid are blank (looking at the rendered HTML they contain a non-breaking space  ). When I do a search I do get the drop-down list as I expect, but the search never finds any records.

    I checked the Developer’s console for Chrome – the response to the AJAX query for main.php has all of the data in it:

    {“records”:5,”page”:1,”total”:1,”rows”:[{“ID”:2,”CustomerFullName”:”Ginger Grant”,”Status”:”Active”},{“ID”:1,”CustomerFullName”:”Jonas Grumby”,”Status”:”Archived”},{“ID”:3,”CustomerFullName”:”Lovey Howell”,”Status”:”Inactive”},{“ID”:5,”CustomerFullName”:”Roy Hinkley”,”Status”:”Active”},{“ID”:4,”CustomerFullName”:”Thurston Howell III”,”Status”:”Active”}]}

    I can’t figure out why I am seeing   in those two columns.

    Ken

    • This reply was modified 9 months, 1 week ago by kgrogers. Reason: Added additional information
    in reply to: Adding Rows and Searching with foriegn keys #128194
    kgrogers
    Participant

    Hi Will:

    When I originally tested the SQL I did it from the command line and it worked fine.  I didn’t try phpMyAdmin until just now and I see the error you are getting.  The problem was that the mysqldump is creating table tblMain before tblStatus.  I re-arragend the SQl and it’s working now for PhpMyAdmin:

     

    in reply to: Adding Rows and Searching with foriegn keys #128192
    kgrogers
    Participant

    When I do that I no longer see the text values in the gird from the foreign table, I only get the IDs, and when I do a search I get no dropdown list.

    Ken

    in reply to: Adding code in the Forum #128178
    kgrogers
    Participant

    The <> icon in the picture is not showing in the editor anymore, so how do we add code?

    Ken

    in reply to: Custom Search Form for Pivot Grid #128130
    kgrogers
    Participant

    Oh, I see – The ContactDate field in the pivot table is just text, so that’s why the ‘between’ oper didn’t work.  I changed the oper to ‘bw’ (begins with) and pass the year from the drop-down and it works perfectly.

     

    All done!  Thanks again for your help.

     

    Ken

    • This reply was modified 1 year ago by kgrogers. Reason: figured out the problem with using the search operator 'bt'
    in reply to: Custom Search Form for Pivot Grid #128129
    kgrogers
    Participant

    Based on your demo and comments I modified my scripts and incorporated the function in your demo.  That is almost working 100% – I just have one part that doesn’t seem to be working.

     

    I added a ‘between’ search for the ContactDate comlum and it doesn’t seem to be working.

     

    Here is my updated code. Any suggestions are appreciated.

    index.php

    leaderboard.php

     

    in reply to: Custom Search Form for Pivot Grid #128128
    kgrogers
    Participant

    I did see that in your original reply.

     

    I did some testing and it turns out that all of the things I want to filter on aren’t actually in the pivot data – when I initially wrote this I didn’t realize that the initial data was a one-shot thing.

     

    Thanks for the help – I need to go back to the drawing board and come up with a different method to accomplish what I have in mind.

     

    Ken

    in reply to: Custom Search Form for Pivot Grid #128126
    kgrogers
    Participant

    Hi Will:

     

    I must be missing something here. The example you provided is not using PHP, nor is it a pivot table. It looks to me like a straight up javascript only clone of the example on your website for custom search with a PHP grid.

     

    I understand about adding a click event in the index.php file, but I don’t see how that ever would change anything in the leaderboard.php file since it’s not referenced.

     

    Ken

    in reply to: Custom Search Form for Pivot Grid #128123
    kgrogers
    Participant

    Hi Will:

     

    I guess I should have been more specific – and perhaps I posted in the wrong forum too.

    I have a PHP pivotGrid that I want to add filtering to, if that’s possible.

     

    Here is my code:

    index.php

    <form action=”#”> <label for=”LPC”>LPC:</label> <select id=”LPC” name=”LPC”> <option value=’%’>All</option> </select> <label for=”year”>Year:</label> <select id=”year” name=”year”> <option value=’%’>All</option> </select> <label for=”year”>Month:</label> <select id=”month” name=”month”> <option value=’%’>All</option> </select> <input id=”search” type=”button” value=”Search”></input> </form> <br />

    <?php include(“leaderboard.php”); ?> </body> </html>

     

    leaderboard.php

     

    • This reply was modified 1 year, 1 month ago by kgrogers.
    in reply to: Custom Search Form for Pivot Grid #128121
    kgrogers
    Participant

    I am looking forward to seeing the example!

     

    Ken

    in reply to: Add row to different table after insert #128113
    kgrogers
    Participant

    (For some reason the Code icon is missing from this compose window – sorry in advance for the ugly code block).

     

    I made the changes you suggested:
    <p style=”padding-left: 40px;”>// Set output format to json
    $grid2->dataType = ‘json’;
    $grid2->setTable = ‘tblLandOwners’;
    $grid2->table = ‘tblLandOwners’;
    $grid2->setPrimaryKeyID(‘LandOwnerID’);
    $grid2->serialKey = true;
    if ($grid2->oper == ‘add’) {
        $data = filter_input_array(INPUT_POST);
        $grid2->trans = false;
        if ($grid2->insert($data)) {
            // $sql = “select LAST_INSERT_ID()”;
            // $stmt = $conn->query($sql);
            // $lastInsertID = $stmt->fetch();
            $lastInsertID = $conn->lastInsertId();
            // Create a ‘blank’ record for this landowner in tblParcels
            $sql = “insert into tblParcels (LandOwnerID) values(“.$lastInsertID[0].”)”;
            $conn->query($sql);
        }
    }
    $grid2->add = false;</p>
    <p style=”padding-left: 40px;”>// Let the grid create the model
    $grid2->setColModel();</p>
    The insert for tblLandOwners worked, but no record was created in tblParcels.

    Ken

    in reply to: Add row to different table after insert #128111
    kgrogers
    Participant

     

    And just for completeness – here’s tblParcels

    I did manage to find a workaround that actually worked. Rather than using the $grid->getLastInsertId() method, I used the MySQL LAST_INSERT_ID() function:

     

    That worked like a champ.

     

    Ken

    in reply to: Add row to different table after insert #128109
    kgrogers
    Participant

    I added some test code based on what you said, but I never get any value with the $grid->getLastInsertId method.

     

    Here’s what I added:

    After I perform the insert, the text file I created (addloform.txt) contains:

    Data: Array
    (
    [LandOwnerID] =>
    [LandOwner] => Rogers, K&T
    [LandOwnerNotes] => jj
    [Status] => 1
    [CurrentlyAssignedTo] => 26
    [LandOwnerAddress1] => 86 Gruiver Rd
    [LandOwnerAddress2] =>
    [LandOwnerCity] => Branchburg
    [LandOwnerState] => NJ
    [LandOwnerZip] => 08876
    [HowToContact] => kjh
    [MailingSalutation] => lkjh
    [AddressedTo] => lkjh
    [oper] => add
    )

    Last insert LandOwnerID:

    It looks like the $grid->getLastInsertId method is returning something (since the value got reset from “none set”), but it’s not the primary key from the insert.

     

    The Help file for this method reads:

    The method return the last inserted id when a add is performed and the primary key is serial. In order to have effect this method should be called after renderGrid, editGrid or insert methods – see below

    API Tags:
    Access: public

    Is it possible I have it in the wrong place?

    Ken

    in reply to: Cloning Pager to Top Loses Number of Pages #128103
    kgrogers
    Participant

    Hi Will

     

    If you could send that to me I’d appreciate it.

     

    Do you have a target date for the next release?

     

    Ken

Viewing 15 replies - 1 through 15 (of 40 total)

Stay connected with us in your favorite flavor!