Permalink
Browse files

Links for column search in select

  • Loading branch information...
1 parent e8b95f1 commit e2dbb9c7bdf7f2282fb6b75f779589f5b405054b @vrana committed Jul 29, 2012
Showing with 26 additions and 1 deletion.
  1. +3 −1 adminer/select.inc.php
  2. +22 −0 adminer/static/functions.js
  3. +1 −0 changes.txt
View
@@ -273,10 +273,12 @@
if ($name != "") {
$rank++;
$names[$key] = $name;
- $column = idf_escape($key);
$href = remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key);
echo '<th><a href="' . h($href) . '">' . (!$select || $val ? apply_sql_function($val["fun"], $name) : h(current($select))) . "</a>"; //! columns looking like functions
echo "<a href='" . h("$href&desc%5B0%5D=1") . "' title='" . lang('descending') . "' class='text'> ↓</a>";
+ if (!$val["fun"]) {
+ echo '<a href="#fieldset-search" onclick="selectSearch(\'' . h(js_escape($key)) . '\'); return false;" title="' . lang('Search') . '" class="text jsonly"> =</a>';
+ }
}
$functions[$key] = $val["fun"];
next($select);
@@ -262,6 +262,28 @@ function selectFieldChange(form) {
+/** Fill column in search field
+ * @param string
+ */
+function selectSearch(name) {
+ var el = document.getElementById('fieldset-search');
+ el.className = '';
+ var divs = el.getElementsByTagName('div');
+ for (var i=0; i < divs.length; i++) {
+ var div = divs[i];
+ if (selectValue(div.firstChild) == name) {
+ break;
+ }
+ }
+ if (i == divs.length) {
+ div.firstChild.value = name;
+ div.firstChild.onchange();
+ }
+ div.lastChild.focus();
+}
+
+
+
/** Send form by Ctrl+Enter on <select> and <textarea>
* @param KeyboardEvent
* @param [string]
View
@@ -1,4 +1,5 @@
Adminer 3.4.1-dev:
+Links for column search in select
Display assigned auto_increment after clone
SQLite: Full alter table
SQLite: Better editing in tables without primary key

0 comments on commit e2dbb9c

Please sign in to comment.