Commit 79e0a36fdf9a2bb34e0245b53e6a5077b428affa
1 parent
646095a1
replace select by select2 in jqgrid
Showing
2 changed files
with
34 additions
and
14 deletions
Show diff stats
view/jqgrid.anubis
| ... | ... | @@ -18,12 +18,12 @@ define String |
| 18 | 18 | ( |
| 19 | 19 | List((List(CoreAttrs), WebArgValue, String)) from_hk_selector |
| 20 | 20 | )= |
| 21 | - logDebug("to_jqGrid_selector: entry"); | |
| 21 | + //logDebug("to_jqGrid_selector: entry"); | |
| 22 | 22 | with start_time = unow, |
| 23 | 23 | with result = "\""+ |
| 24 | 24 | join(";",map(((List(CoreAttrs), WebArgValue, String) select) |-> since select is (_, wav, show), wav.value+":"+show, from_hk_selector))+ |
| 25 | 25 | "\"", |
| 26 | - logDebug(show_duration_string("to_jqGrid_selector: duration ", start_time)); | |
| 26 | + //logDebug(show_duration_string("to_jqGrid_selector: duration ", start_time)); | |
| 27 | 27 | result |
| 28 | 28 | . |
| 29 | 29 | |
| ... | ... | @@ -118,22 +118,35 @@ define String |
| 118 | 118 | text(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, "+search_options(column_name)+" }", |
| 119 | 119 | password(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", autoResizable: true }", |
| 120 | 120 | foreign_text(label,column_name,selector,help) then |
| 121 | + logDebug("to_jqGrid_ColModel 1: foreign_text column_name "+column_name); | |
| 121 | 122 | with jqgrid_selector = to_jqGrid_selector(selector.get(db,table_referer,"")), |
| 122 | - "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype:\"select\", editoptions:{value: "+jqgrid_selector+"},"+ | |
| 123 | - " formatter: \"select\","+ | |
| 124 | - " formatoptions:{value: "+jqgrid_selector+"},"+ | |
| 123 | + "{ name: '"+column_name+"', label: '"+_T(label)+"', editable:true, autoResizable: true, edittype:'select', editoptions: {value: "+jqgrid_selector+", dataInit: function (elem) { | |
| 124 | + $(elem).select2({ | |
| 125 | + dropdownCssClass: 'ui-widget ui-jqdialog', | |
| 126 | + width: '100%' | |
| 127 | + }); | |
| 128 | +}},"+ | |
| 129 | + //" formatter: \"select\","+ | |
| 130 | + //" formatoptions:{value: "+jqgrid_selector+"},"+ | |
| 125 | 131 | "}", |
| 126 | 132 | choices_text(label,column_name,selector,help) then |
| 133 | + logDebug("to_jqGrid_ColModel 1: choices_text column_name "+column_name); | |
| 127 | 134 | with jqgrid_selector = to_jqGrid_selector(selector.get(db, empty_referer, "")), |
| 128 | - "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype:\"select\", editoptions:{value: "+jqgrid_selector+"},"+ | |
| 129 | - " formatter: \"select\","+ | |
| 130 | - " formatoptions:{value: "+jqgrid_selector+"},"+ | |
| 135 | + "{ name: '"+column_name+"', label: '"+_T(label)+"', editable:true, autoResizable: true, edittype:'select', editoptions:{value: "+jqgrid_selector+",dataInit: function (elem) { | |
| 136 | + $(elem).select2({ | |
| 137 | + dropdownCssClass: 'ui-widget ui-jqdialog', | |
| 138 | + width: '100%' | |
| 139 | + }); | |
| 140 | +}},"+ | |
| 141 | + //" formatter: \"select\","+ | |
| 142 | + //" formatoptions:{value: "+jqgrid_selector+"},"+ | |
| 131 | 143 | "}", |
| 132 | 144 | text_area(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\" }", |
| 133 | 145 | boolean(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"booleanCheckboxFa\" }", |
| 134 | 146 | integer(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"integer\" }", |
| 135 | 147 | float(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"number\" }", |
| 136 | 148 | choices_int(label,column_name,selector,help) then |
| 149 | + logDebug("to_jqGrid_ColModel 1: choices_int column_name "+column_name); | |
| 137 | 150 | with jqgrid_selector = to_jqGrid_selector(selector.get(db, empty_referer, "")), |
| 138 | 151 | "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype:\"select\", editoptions:{value: "+jqgrid_selector+"},"+ |
| 139 | 152 | " formatter: \"select\","+ | ... | ... |
view/view_table_renderer.anubis
| ... | ... | @@ -379,7 +379,7 @@ define String |
| 379 | 379 | )= |
| 380 | 380 | logDebug("jqGrid_options: entry"); |
| 381 | 381 | with result = " |
| 382 | - editurl: '?aws_controller=hk_c&aws_action=grid_action&table_name="+rows.table_name+"', | |
| 382 | + editurl: '?aws_c=hk_c&aws_a=grid_action&table_name="+rows.table_name+"', | |
| 383 | 383 | iconSet: \"fontAwesome\", |
| 384 | 384 | cmTemplate: { autoResizable: true}, |
| 385 | 385 | autoResizing: { compact: true, resetWidthOrg: true }, |
| ... | ... | @@ -394,8 +394,8 @@ define String |
| 394 | 394 | rowList:[5,10,20,30,50], |
| 395 | 395 | cellEdit: false, |
| 396 | 396 | cellsubmit: 'remote', |
| 397 | - cellurl: '?aws_controller=hk_c&aws_action=grid_action&table_name="+rows.table_name+"', | |
| 398 | - editurl: '?aws_controller=hk_c&aws_action=grid_action&table_name="+rows.table_name+"', | |
| 397 | + cellurl: '?aws_c=hk_c&aws_a=grid_action&table_name="+rows.table_name+"', | |
| 398 | + editurl: '?aws_c=hk_c&aws_a=grid_action&table_name="+rows.table_name+"', | |
| 399 | 399 | onSelectRow: function (rowid, status, e) { |
| 400 | 400 | var $self = $(this), savedRow = $self.jqGrid(\"getGridParam\", \"savedRow\"); |
| 401 | 401 | if (savedRow.length > 0 && savedRow[0].id !== rowid) { |
| ... | ... | @@ -462,7 +462,7 @@ public define HTML_Partial_Content |
| 462 | 462 | logDebug("jqGrid_table: entry"); |
| 463 | 463 | with filter_clause = if clause = "" then "" else "&clause="+url_quote(clause), |
| 464 | 464 | with referer_arg = "&"+to_Web_arg(table_referer, ""), |
| 465 | - with js = js_inline(jquery_ready( | |
| 465 | + with js_init = js_inline(jquery_ready( | |
| 466 | 466 | "var lastSel; |
| 467 | 467 | initAutocomplete = function (elem, cmName) { |
| 468 | 468 | $(elem).autocomplete({ |
| ... | ... | @@ -518,7 +518,10 @@ url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&vi |
| 518 | 518 | return ret; |
| 519 | 519 | }")), |
| 520 | 520 | logDebug("jqGrid_table: partial_content"); |
| 521 | - partial_content(jqgrid_init(lang) + [js, css(css_file("hayamiki/css/hayamiki.css"))], | |
| 521 | + partial_content(jqgrid_init(lang) + [js_init, | |
| 522 | + css(css_file("hayamiki/css/hayamiki.css")), | |
| 523 | + js(js_file("select2/js/select2.full.js")), | |
| 524 | + css(css_file("select2/css/select2.css"))], | |
| 522 | 525 | div([], |
| 523 | 526 | sequence([ |
| 524 | 527 | table([core_attrs([id(uid+"_grid")])],[]), |
| ... | ... | @@ -753,7 +756,7 @@ public define List(CXM_Form_Field) |
| 753 | 756 | //Get the priority of the web argument content for the value, this means the value already set by the user or called with programmaticaly with it |
| 754 | 757 | with value = get_DB_id(lwa, c_name, _value), |
| 755 | 758 | //create refresh function and call it first to construct the dropdown |
| 756 | - with load_script = script("text/javascript","function "+refresh_func+"() { Xlib.load_content('"+uid+foreign_table_name+"_"+c_name+"_selector', '?aws_controller=hk_c&aws_action=selector&table_name="+foreign_table_name+"&fk_filter="+fk_clause+"&selected="+value+"&"+to_Web_arg(table_referer, "")+"');} "+refresh_func+"(); "), | |
| 759 | + with load_script = script("text/javascript","function "+refresh_func+"() { Xlib.load_content('"+uid+foreign_table_name+"_"+c_name+"_selector', '?aws_c=hk_c&aws_a=selector&table_name="+foreign_table_name+"&fk_filter="+fk_clause+"&selected="+value+"&"+to_Web_arg(table_referer, "")+"'); $('#"+uid+foreign_table_name+"_"+c_name+"_selector').select2();} "+refresh_func+"(); "), | |
| 757 | 760 | [ |
| 758 | 761 | partial(jq_dialog_create(dialog_id(uid+foreign_table_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+foreign_table_name+"_dlg_ajax&sub_dialog=true&table_name="+foreign_table_name+"&after_close_cb="+refresh_func)))), |
| 759 | 762 | one_line_fields([ |
| ... | ... | @@ -889,6 +892,8 @@ public define HTML_Partial_Content |
| 889 | 892 | partial_content( |
| 890 | 893 | [ js(js_file("hayamiki/js/jscolor.min.js")), |
| 891 | 894 | js(js_file("xlib/js/dropzone.js")), |
| 895 | + js(js_file("select2/js/select2.full.min.js")), | |
| 896 | + css(css_file("select2/css/select2.min.css")), | |
| 892 | 897 | js_inline(jquery_ready("Dropzone.options.myAwesomeDropzone = { |
| 893 | 898 | maxFiles: 100, |
| 894 | 899 | dictDefaultMessage : \""+_T("DROP_FILE_HERE")+"\", |
| ... | ... | @@ -1044,6 +1049,8 @@ public define List(CXM_Form_Field) |
| 1044 | 1049 | partial(partial_content([ |
| 1045 | 1050 | js(js_file("ajax-combobox/js/jquery.ajax-combobox.js")), |
| 1046 | 1051 | css(css_file("ajax-combobox/css/jquery.ajax-combobox.css")), |
| 1052 | + js(js_file("select2/js/select2.full.min.js")), | |
| 1053 | + css(css_file("select2/css/select2.min.css")), | |
| 1047 | 1054 | js_inline(jquery_ready(combo_init))], |
| 1048 | 1055 | jq_dialog_create(dialog_id(uid+foreign_table_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+foreign_table_name+"_dlg_ajax&sub_dialog=true&table_name="+foreign_table_name))))), |
| 1049 | 1056 | one_line_fields([ | ... | ... |