feature: Added support for populating selects from ajax (#6557)

fixes: #5264

The issue was all the string concatenation...

But I decided to try loading the select via ajax. Seems ok.  We could just use something like select2.  Opinions? Use this approach or load at page load.
I was able to reduce the loading of the 4000 select items from 1.6s to 0.6s on my laptop by optimizing the sql.

I added 4000 devices to my database to check this :)
This commit is contained in:
Tony Murray
2017-05-03 16:51:01 -05:00
committed by Neil Lathwood
parent 02d9b36720
commit 2b3ca49bea
5 changed files with 123 additions and 43 deletions

View File

@@ -22,18 +22,18 @@ if (!$_SESSION['authenticated']) {
set_debug($_REQUEST['debug']);
$current = $_POST['current'];
$current = $_REQUEST['current'];
settype($current, 'integer');
$rowCount = $_POST['rowCount'];
$rowCount = $_REQUEST['rowCount'];
settype($rowCount, 'integer');
if (isset($_POST['sort']) && is_array($_POST['sort'])) {
foreach ($_POST['sort'] as $k => $v) {
if (isset($_REQUEST['sort']) && is_array($_POST['sort'])) {
foreach ($_REQUEST['sort'] as $k => $v) {
$sort .= " $k $v";
}
}
$searchPhrase = mres($_POST['searchPhrase']);
$id = mres($_POST['id']);
$searchPhrase = mres($_REQUEST['searchPhrase']);
$id = mres($_REQUEST['id']);
$response = array();
if (isset($id)) {