/* * Created by PyramIDE. * User: フランスのトトロ aka (David RENÉ) * Date: 21/03/2017 * Time: 22:49 * © Calexium */ read calexium_lib/web/CXM_making_a_web_site.anubis read hayamiki_lib/types/hayamiki.anubis read view_table_types.anubis define String to_jqGrid_selector ( List((List(CoreAttrs), WebArgValue, String)) from_hk_selector )= "\""+ join(";",map(((List(CoreAttrs), WebArgValue, String) select) |-> since select is (_, wav, show), wav.value+":"+show, from_hk_selector))+ "\"" . define String to_jqGrid_ColModel ( SQLite3DataBase db, VT_view_model_entry model )= if model is { primary_key then "{ name: \"id\" }", information(label,column_name,width,help) then "{ name: \""+column_name+"\", label: \""+label+"\" }", text(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true }", password(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\" }", foreign_text(label,column_name,selector,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ " formatter: \"select\","+ " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ "}", choices_text(label,column_name,selector,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ " formatter: \"select\","+ " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ "}", text_area(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\" }", boolean(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, template: \"booleanCheckboxFa\" }", integer(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, template: \"integer\" }", float(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, template: \"number\" }", choices_int(label,column_name,selector,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ " formatter: \"select\","+ " formatoptions:{value: "+to_jqGrid_selector(selector.get(db,""))+"},"+ "}", date(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true, formatter: \"date\", formatoptions: { newformat: \"Y-M-d\" }}", time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true }", datetime(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+label+"\", editable:true }", } . public define String to_jqGrid_ColModel ( SQLite3DataBase db, List(VT_view_model_entry) models )= "colModel: [\n"+ join(",\n ", [ "{name: 'myac', label: 'Action', width:60, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}}" . map((VT_view_model_entry col_model) |-> to_jqGrid_ColModel(db, col_model), models) ] )+ "]" .