Browse Source

disable comboLookup dropdown + comboLookupVector validation

bohdan.kotenko 4 years ago
parent
commit
ea43638373
4 changed files with 16 additions and 11 deletions
  1. 1 1
      mix.exs
  2. 6 4
      priv/js/sortable.js
  3. 8 5
      src/elements/combo/element_comboLookup.erl
  4. 1 1
      src/nitro.app.src

+ 1 - 1
mix.exs

@@ -4,7 +4,7 @@ defmodule NITRO.Mixfile do
   def project do
     [
       app: :nitro,
-      version: "6.4.4",
+      version: "6.5.0",
       description: "NITRO Nitrogen Web Framework",
       package: package(),
       deps: deps()

+ 6 - 4
priv/js/sortable.js

@@ -168,11 +168,13 @@ function () {
         value = value.text;
       }
       var inputElement = document.getElementById(input);
-      if (inputElement) {
-        inputElement.value = '';
-        inputElement.removeAttribute("data-bind")
+      if (bind !== '' && bind !== 'null') {
+        if (inputElement) {
+          inputElement.value = '';
+          inputElement.removeAttribute("data-bind")
+        }
+        appendItemFromBind(this.list.id,value,bind);
       }
-      appendItemFromBind(this.list.id,value,bind);
     }
   }, {
     key: "getValues",

+ 8 - 5
src/elements/combo/element_comboLookup.erl

@@ -27,10 +27,13 @@ render_element(#comboLookup{id=Id, style=Style, value = Val, bind = Object,
                         value = Val, style = Style, class = column},
                  #panel{class=['triangle'],
                         body="▾",
-                        onclick = nitro:jse("comboLookupClick('"
-                               ++ nitro:to_list(Id) ++ "','"
-                               ++ nitro:to_list(Feed) ++ "','"
-                               ++ nitro:to_list(Module) ++ "')")},
+                        onclick =
+                          case Disabled of
+                            true -> [];
+                            _ -> nitro:jse("comboLookupClick('"
+                              ++ nitro:to_list(Id) ++ "','"
+                              ++ nitro:to_list(Feed) ++ "','"
+                              ++ nitro:to_list(Module) ++ "')")
+                          end},
                  #panel{id=form:atom([comboContainer, Id]),
                         class = ['dropdown-content']}]}).
-

+ 1 - 1
src/nitro.app.src

@@ -1,6 +1,6 @@
 {application, nitro, [
     {description,  "NITRO Nitrogen Web Framework"},
-    {vsn,          "6.4.4"},
+    {vsn,          "6.5.0"},
     {applications, [kernel, stdlib]},
     {modules, []},
     {registered,   []},