Commit b705d457 by aa.gusti

perbaikan detable

1 parent 808b8a58
......@@ -430,9 +430,8 @@ class BaseView(object):
if k in select_list.keys():
vals = select_list[k]
for r in vals:
if r[0] == res[k]:
res[k] = r[1]
""
if r and str(r) == str(res[k]):
res[k] = vals[r]
# for k, v in d.items():
# if k in url and v:
# link = "/".join([self.home, nik_url, v])
......
......@@ -428,7 +428,7 @@ class DeTable(field.Field):
html += f'placeholder="{f.title}" {txt}/>'
html += '<option value="">Semua</option>'
if type(wg_select_val) == list:
wg_select_val = dict(list)
wg_select_val = dict(wg_select_val)
for key in wg_select_val:
html += f'<option value="{key}">{wg_select_val[key]}</option>'
......
......@@ -110,7 +110,7 @@
function displayEmptyID() {
$("#emptyID").show();
$('#emptyID').animate({ opacity: 0.8 }, 2000);
$('#emptyID').animate({opacity: 0.8}, 2000);
setTimeout(function () {
$("#emptyID").fadeTo(500, 0).slideUp(500, function () {
$("#emptyID").hide();
......@@ -154,7 +154,7 @@
function render_checklist(value) {
return '<input type="checkbox" class="${tableid}_check" checked="' + { value } + '"></input>';
return '<input type="checkbox" class="${tableid}_check" checked="' + {value} + '"></input>';
}
......@@ -169,12 +169,13 @@
}
return render_checkbox(false);
}
} else if (${tableid}Columns[co].wg_select === true) {
${tableid}Columns[co].render = function (value) {
if (value!=null)
return ${tableid}Columns[co].wg_select_val[value];
return "";
}
//}
//else if (${tableid}Columns[co].wg_select === true) {
// ${tableid}Columns[co].render = function (value) {
// if (value != null)
// return ${tableid}Columns[co].wg_select_val[value];
// return "";
// }
} else if (${tableid}Columns[co].hasOwnProperty("url")) {
let url = ${tableid}Columns[co].url;
${tableid}Columns[co].render = function (data) {
......@@ -224,16 +225,12 @@
let ${tableid}Params = {}
var param_ajax = "";
var param_data = "";
var param_data = [];
if (!${server_side}) {
param_data = ${data};
param_ajax = "";
} else {
param_ajax = o${tableid}Url;
param_data = [];
}
o${tableid} = $('#${tableid}').DataTable({
scrollX: ${field.scroll_x},
//scrollY: ${field.scroll_y},
......@@ -294,9 +291,7 @@
<tal:block tal:condition="filter_columns">
$(".${tableid}-control-filter").on('keyup', function (e) {
var code = e.keyCode || e.which;
if (code === 13) {
filter_table()
}
if (code === 13) filter_table();
});
function filter_table() {
......@@ -315,7 +310,8 @@
.column($(this).data('index'))
.search(this.value)
}
} else if ($(this).attr("type") === 'date') {
}
else if ($(this).attr("type") === 'date') {
value = this.value;
localStorage.setItem(col_id, value);
var splitted = col_id.split('-');
......@@ -340,7 +336,8 @@
o${tableid}
.column($(this).data('index'))
.search(min_val + '-yadcf_delim-' + max_val, true)
} else {
}
else {
col_id = this.id;
value = this.value;
if (value === undefined || value === null) {
......@@ -353,6 +350,7 @@
.search(value);
}
});
//o${tableid}.ajax.url(o${tableid}Url).load();
o${tableid}.draw();
}
......@@ -360,7 +358,7 @@
console.log("Write Data Click");
var typ = $(this).attr("type");
if (typ === 'radio') {
filter_table()
filter_table();
}
});
$(".${tableid}-control-filter").on('change', function (e) {
......@@ -368,12 +366,14 @@
if (typ === "select") {
filter_table()
}
var typ = $(this).attr("type").toLowerCase();
if (typ === "date") {
filter_table()
filter_table();
}
});
console.log("Read Data");
$(".${tableid}-control-filter").each(function (e) {
var col_id = $(this).attr("id")
......@@ -391,10 +391,11 @@
if (value !== undefined && value !== null)
$(this).val(value);
}
console.log(col_id, $(this).attr('id'), value);
//console.log(col_id, $(this).attr('id'), value);
});
filter_table();
</tal:block>
${structure: btnscripts}
${structure: filter_scripts}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!