Page 1 of 1

simple layout

Posted: 2020-05-23 08:03
by pmartin
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 7382 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

Re: simple layout

Posted: 2020-05-24 17:10
by patsd102
This should sort 1 thing for you

Image

Re: simple layout

Posted: 2020-05-24 17:36
by patsd102
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>';

Re: simple layout

Posted: 2020-05-29 21:24
by pmartin
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

Re: simple layout

Posted: 2020-05-30 06:06
by patsd102
It seems these commands are now obsolete


Pat

Re: simple layout

Posted: 2020-05-30 06:46
by pbottcher
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.

Re: simple layout

Posted: 2020-05-30 07:24
by patsd102
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,

Re: simple layout

Posted: 2020-06-02 20:46
by pmartin
test

Re: simple layout

Posted: 2020-06-02 20:49
by pmartin
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

Re: simple layout

Posted: 2020-06-04 22:02
by pmartin
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 5951 times
Webp.net-resizeimage (2).png
Webp.net-resizeimage (2).png (103.97 KiB) Viewed 5951 times
Webp.net-resizeimage (3).png
Webp.net-resizeimage (3).png (123.44 KiB) Viewed 5951 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

Re: simple layout

Posted: 2020-06-04 22:56
by jsetzer
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 5946 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.