Commit 76b43898 by aa.gusti

perbaikan auto complete

1 parent b92ee29e
...@@ -522,7 +522,7 @@ def get_route_names(rows): ...@@ -522,7 +522,7 @@ def get_route_names(rows):
def get_children(rows): def get_children(rows):
_logging.debug(f"Children: {dict(rows.__dict__)}") # _logging.debug(f"Children: {dict(rows.__dict__)}")
return [dict( return [dict(
order_id=r.order_id, order_id=r.order_id,
id=r.id, id=r.id,
......
...@@ -31,8 +31,7 @@ from datetime import datetime ...@@ -31,8 +31,7 @@ from datetime import datetime
import colander import colander
from deform import (widget, FileData, ValidationFailure) from deform import (widget, FileData, ValidationFailure)
from opensipkd.pbb.esppt.tools import date_from_str from opensipkd.tools import Upload, mem_tmp_store, image_validator, date_from_str
from opensipkd.tools import Upload, mem_tmp_store, image_validator
from opensipkd.tools.buttons import btn_cancel, btn_register, btn_save from opensipkd.tools.buttons import btn_cancel, btn_register, btn_save
from pyramid.httpexceptions import HTTPFound from pyramid.httpexceptions import HTTPFound
from pyramid.i18n import TranslationStringFactory from pyramid.i18n import TranslationStringFactory
......
...@@ -488,7 +488,7 @@ class MapWidget(Widget): ...@@ -488,7 +488,7 @@ class MapWidget(Widget):
def __init__(self, **kw): def __init__(self, **kw):
super().__init__(**kw) super().__init__(**kw)
_logging.info(self.gmap_data_style) _logging.debug(self.gmap_data_style)
self.gmap_data_style = json.dumps(self.gmap_data_style) self.gmap_data_style = json.dumps(self.gmap_data_style)
def serialize(self, field, cstruct, **kw): def serialize(self, field, cstruct, **kw):
...@@ -505,7 +505,7 @@ class MapWidget(Widget): ...@@ -505,7 +505,7 @@ class MapWidget(Widget):
"removable": not readonly, "removable": not readonly,
} }
self.gmap_data_style = json.dumps(gmap_data_style) self.gmap_data_style = json.dumps(gmap_data_style)
_logging.info(self.gmap_data_style) _logging.debug(self.gmap_data_style)
values = self.get_template_values(field, cstruct, kw) values = self.get_template_values(field, cstruct, kw)
return field.renderer(template, **values) return field.renderer(template, **values)
......
...@@ -18,13 +18,28 @@ ...@@ -18,13 +18,28 @@
deform.addCallback( deform.addCallback(
'${oid}', '${oid}',
function (oid) { function (oid) {
$('#' + oid + '-auto_value').typeahead(${structure: options}); $('#' + oid + '-auto_value').typeahead(${ structure: options });
if ("${autofocus}" == "autofocus") { if ("${autofocus}" == "autofocus") {
$('#' + oid + '-auto_value').focus(); $('#' + oid + '-auto_value').focus();
} }
$('#' + oid + '-auto_value').bind('typeahead:selected', function (obj, datum, name) { $('#' + oid + '-auto_value').bind('typeahead:selected', function (obj, datum, name) {
$('#' + oid + '-auto_id').val(datum.id); $('#' + oid + '-auto_id').val(datum.id);
var not_check = ["id", "value"];
$.each(datum, function (key, val) {
if (!not_check.includes(key)) {
var ele = $('#' + key);
if (ele !== undefined) {
var eleName = ele.prop('nodeName').toLowerCase();
if (eleName === "select")
$("#" + key).val(val).trigger("change");
else if (eleName === "input")
$("#" + key).val(val);
else
$("#" + key).text(val);
}
}
});
$('#' + oid + '-auto_id').change(); $('#' + oid + '-auto_id').change();
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!