From 3948b4f1e5b93c8b6ed2599174eec0cf3ec358c2 Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 6 May 2017 09:22:54 +0900 Subject: [PATCH] add phone and email fields in entry --- view/jqgrid.anubis | 41 ++++++++++++++++++++++++++++++++++++++++- view/types/hk_form_entry.anubis | 4 +++- view/types/hk_view.anubis | 5 ++++- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/view/jqgrid.anubis b/view/jqgrid.anubis index 5db291f..1dfc475 100644 --- a/view/jqgrid.anubis +++ b/view/jqgrid.anubis @@ -20,7 +20,43 @@ define String join(";",map(((List(CoreAttrs), WebArgValue, String) select) |-> since select is (_, wav, show), wav.value+":"+show, from_hk_selector))+ "\"" . - + +define String + custom_edit_phone = +" editoptions: { + custom_element: function(value, options) { + var elemStr = ''; + var elem = $(elemStr)[0]; + // return DOM element from jQuery object + return elem; + }, + custom_value: function(elem) { + //var inputs = $(\"input\", $(elem)[0]); + //var first = inputs[0].value; + return $(elem).find('input')[0].value; + } + } +" +. + +define String + custom_edit_email = +" editoptions: { + custom_element: function(value, options) { + var elemStr = ''; + var elem = $(elemStr)[0]; + // return DOM element from jQuery object + return elem; + }, + custom_value: function(elem) { + //var inputs = $(\"input\", $(elem)[0]); + //var first = inputs[0].value; + return $(elem).find('input')[0].value; + } + } +" +. + define String to_jqGrid_ColModel ( @@ -58,6 +94,9 @@ define String time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true }", datetime(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true }", color(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", width: 60, editable:false, formatter:formatColor}", + phone(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, edittype: 'custom', formatter:formatPhone, unformat:unformatPhone, "+custom_edit_phone+"}", + email(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, edittype: 'custom', formatter:formatEmail, unformat:unformatEmail, "+custom_edit_email+"}", + } . diff --git a/view/types/hk_form_entry.anubis b/view/types/hk_form_entry.anubis index b76cef0..5eb2fbb 100644 --- a/view/types/hk_form_entry.anubis +++ b/view/types/hk_form_entry.anubis @@ -34,7 +34,9 @@ public type HK_Form_Entry: //legacy VT_Edit date (String s_name, String c_name, String value, HK_Help_Text help), time (String s_name, String c_name, String value, HK_Help_Text help), datetime (String s_name, String c_name, String value, HK_Help_Text help), - color (String s_name, String c_name, String value, HK_Help_Text help) + color (String s_name, String c_name, String value, HK_Help_Text help), + phone (String s_name, String c_name, String value, HK_Help_Text help), + email (String s_name, String c_name, String value, HK_Help_Text help) . public define HK_Form_Entry text (String s_name, String c_name, String value) = text (s_name, c_name, value, no_help_text). diff --git a/view/types/hk_view.anubis b/view/types/hk_view.anubis index 9971a21..d13add3 100644 --- a/view/types/hk_view.anubis +++ b/view/types/hk_view.anubis @@ -70,7 +70,10 @@ public type VT_view_model_entry: date (String label, String column_name, HK_Help_Text help), time (String label, String column_name, HK_Help_Text help), datetime (String label, String column_name, HK_Help_Text help), - color (String label, String column_name, HK_Help_Text help). + color (String label, String column_name, HK_Help_Text help), + phone (String label, String column_name, HK_Help_Text help), + email (String label, String column_name, HK_Help_Text help) +. public type VT_view_model: -- libgit2 0.21.4