simple layout

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
pmartin
Posts: 5
Joined: 2020-05-20 12:39

simple layout

Post by pmartin » 2020-05-23 08:03

Hi Folks i'm new to all of this stuff and wondered if anyone can help me, i'm looking to alter my layout.

APPGINI3.jpg
APPGINI3.jpg (81.94 KiB) Viewed 4559 times
1)Move the search box to the centre of the screen

2)no records are to be show unless search criteria is found

3)remove goto and next page


Thanks p.s be gentle

patsd102
Veteran Member
Posts: 142
Joined: 2013-01-15 19:59

Re: simple layout

Post by patsd102 » 2020-05-24 17:10

This should sort 1 thing for you

Image
23.17

patsd102
Veteran Member
Posts: 142
Joined: 2013-01-15 19:59

Re: simple layout

Post by patsd102 » 2020-05-24 17:36

In the datalist.php comment out the following lines to remove go to and next functions. (Warning, this will remove from all tables)

Around line 1043 comment out this line //$pagesMenu = $Translation['go to page'] . ' <select style="width: 90%; max-width: 8em;" class="input-sm ltr" id="' . $pagesMenuId . '" onChange="document.myform.writeAttribute(\'novalidate\', \'novalidate\'); document.myform.NoDV.value=1; document.myform.FirstRecord.value=(this.value * ' . $this->RecordsPerPage . '+1); document.myform.submit();">';

Around line 1099 comment out this line //$this->HTML .= $Translation['records x to y of z'];

Around line 1138 comment out this line //if($i < $RecordCount) $this->HTML .= '<button onClick="'.$resetSelection.' document.myform.NoDV.value=1; return true;" type="submit" name="Next_x" id="Next" value="1" class="btn btn-default btn-block"><span class="hidden-xs">' . $Translation['Next'] . '</span> <i class="glyphicon glyphicon-chevron-right"></i></button>';
23.17

pmartin
Posts: 5
Joined: 2020-05-20 12:39

Re: simple layout

Post by pmartin » 2020-05-29 21:24

Thanks for you help it was very useful. I altered the datalist.php file but the above picture I didn't know what to do was it a file? to be edited


Thanks

patsd102
Veteran Member
Posts: 142
Joined: 2013-01-15 19:59

Re: simple layout

Post by patsd102 » 2020-05-30 06:06

It seems these commands are now obsolete


Pat
23.17

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: simple layout

Post by pbottcher » 2020-05-30 06:46

Hi,

you should try to avoid editing of core AppGini files as they will be regenerated once you modify and recreate your app.

In order to handle such changes you can use the hooks provided. You need to write some PHP / JS code to apply your changes.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

patsd102
Veteran Member
Posts: 142
Joined: 2013-01-15 19:59

Re: simple layout

Post by patsd102 » 2020-05-30 07:24

Hi pmartin

You could always set the search to 0 removing it completely and make a custom search box to suit your needs.
https://bigprof.com/appgini/tips-and-tu ... arch-forms

pböttcher is also correct, regenerating your app will override these changes and will need to be reloaded again,
23.17

pmartin
Posts: 5
Joined: 2020-05-20 12:39

Re: simple layout

Post by pmartin » 2020-06-02 20:46

test

pmartin
Posts: 5
Joined: 2020-05-20 12:39

Re: simple layout

Post by pmartin » 2020-06-02 20:49

Where is the setting 0 for the search?

https://bigprof.com/appgini/tips-and-tu ... arch-forms
too complex for me in I know no php code, was under the influence this software did it all, anyway im getting there I just need to
trip my database up so it look better.
www.othertondesign.com/stolenmh

pmartin
Posts: 5
Joined: 2020-05-20 12:39

Re: simple layout

Post by pmartin » 2020-06-04 22:02

Firstly I would like to say a big thank you for all your previous help.
So along the way I have managed to setup a few things but still need help on my layout and are hoping someone can help me.

Webp.net-resizeimage (1).png
Webp.net-resizeimage (1).png (107.46 KiB) Viewed 3128 times
Webp.net-resizeimage (2).png
Webp.net-resizeimage (2).png (103.97 KiB) Viewed 3128 times
Webp.net-resizeimage (3).png
Webp.net-resizeimage (3).png (123.44 KiB) Viewed 3128 times
not sure if anyone understands but when searched and found I just want it to display the details view page and not the other table

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: simple layout

Post by jsetzer » 2020-06-04 22:56

Hi,

there are several tasks:
  1. hide table-view and top-buttons in the beginning.
  2. if there is exactly one match, redirect to detail view and show exactly that one record
  3. if there is more than one match, show table view as usual
You can try with my solution below. Using an additional CSS style I reduce flickering of the table view when page is being loaded.

Modification for task 1

file: hooks/TABLENAME.php
function: TABLENAME_header

Code: Select all

function TABLENAME_header($contentType, $memberInfo, &$args)
{
	$header = '';

	switch ($contentType) {
		case 'tableview':
                        $header = '<%%HEADER%%><style>.table_view, #top_buttons { display: none; }</style><script>var appgini_searchstring="' . stripslashes($_REQUEST["SearchString"]) . '";</script>';
			break;

// keep the rest of the default code
// ...



Modification for tasks 2 and 3

file: hooks/TABLENAME-tv.js

Code: Select all

$j(document).ready(function () {

    // bonus :-)
    $j("input[name='SearchString']").on("focus", function () {
        $j(this).select();
    })
    
    var count = $j("tr[data-id]").length;
    if (count == 1) {
        var id = $j("tr[data-id]:eq(0)").attr("data-id");
        if (id) {
            var url = AppGini.currentTableName() + "_view.php?SelectedID=" + id;
            window.location.href = url;
        }
    } else if (count > 1 && appgini_searchstring.length) {
        $j(".table_view,#top_buttons").css("display", "unset");
    } else {
        $j("input[name='SearchString']").focus();
    }
});
Result

The screen recording below shows three scenarios:
  1. no searchstring = no tableview
    (also: no matches = no tableview)
  2. searchstring + multiple matches = table view showing all matches
  3. searchstring + one match = detail view showing exactly that one match
XeWJ9sCSVJ.gif
XeWJ9sCSVJ.gif (145.48 KiB) Viewed 3123 times

Bonus
Automatic focus on Searchterm input box + select all text on focus for a better search-experience.

I hope this is what you were looking for. If not, I also recommend building a custom search-/filter-form, as someone has already mentioned before.

Best,
Jan

Todo:
In PHP code for task 1 (see above) there probably should be some better string sanitization before settings variable appgini_searchstring. I did not test with searchstrings having code fragments. Gonna leave it "as is" for the gurus here for optimization.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

Post Reply