Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 28b6babd
authored
Dec 14, 2024
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
masih detable
1 parent
3098019a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
16 deletions
opensipkd/base/views/base_views.py
opensipkd/detable/detable.py
opensipkd/detable/templates/detable.pt
opensipkd/base/views/base_views.py
View file @
28b6bab
...
@@ -267,7 +267,10 @@ class BaseView(object):
...
@@ -267,7 +267,10 @@ class BaseView(object):
state_save
=
kwargs
.
get
(
"state_save"
,
self
.
state_save
)
state_save
=
kwargs
.
get
(
"state_save"
,
self
.
state_save
)
filter_columns
=
kwargs
.
get
(
"filter_columns"
,
self
.
filter_columns
)
filter_columns
=
kwargs
.
get
(
"filter_columns"
,
self
.
filter_columns
)
server_side
=
kwargs
.
get
(
"server_side"
,
self
.
server_side
)
if
"server_side"
in
kwargs
:
server_side
=
kwargs
.
get
(
"server_side"
)
else
:
server_side
=
self
.
server_side
new_buttons
=
kwargs
.
get
(
"new_buttons"
)
new_buttons
=
kwargs
.
get
(
"new_buttons"
)
is_object
=
kwargs
.
get
(
"is_object"
)
is_object
=
kwargs
.
get
(
"is_object"
)
list_url
=
kwargs
.
get
(
"list_url"
,
self
.
list_url
)
list_url
=
kwargs
.
get
(
"list_url"
,
self
.
list_url
)
...
...
opensipkd/detable/detable.py
View file @
28b6bab
...
@@ -5,9 +5,8 @@ import logging
...
@@ -5,9 +5,8 @@ import logging
import
re
import
re
import
colander
import
colander
import
deform
# import deform
from
deform
import
compat
from
deform
import
compat
,
widget
as
deform_widget
,
field
from
deform
import
field
from
.
import
widget
from
.
import
widget
...
@@ -138,17 +137,17 @@ class DeTable(field.Field):
...
@@ -138,17 +137,17 @@ class DeTable(field.Field):
self
.
filter_columns
=
filter_columns
self
.
filter_columns
=
filter_columns
self
.
scroll_x
=
json
.
dumps
(
scroll_x
)
self
.
scroll_x
=
json
.
dumps
(
scroll_x
)
self
.
scroll_y
=
json
.
dumps
(
scroll_y
)
self
.
scroll_y
=
json
.
dumps
(
scroll_y
)
# self.widget = None
# Button yang dikirim sebagai tambahan
# Button yang dikirim sebagai tambahan
new_buttons
=
kw
.
get
(
"new_buttons"
)
or
()
new_buttons
=
kw
.
get
(
"new_buttons"
)
or
{}
action_suffix
=
f
"{action_suffix}{params}"
action_suffix
=
f
"{action_suffix}{params}"
close_url
=
self
.
action
.
split
(
"/"
)
close_url
=
self
.
action
.
split
(
"/"
)
close_url
=
"/"
.
join
(
close_url
[:
-
1
])
close_url
=
"/"
.
join
(
close_url
[:
-
1
])
close_url
.
replace
(
":/"
,
"://"
)
close_url
.
replace
(
":/"
,
"://"
)
params
=
params
and
f
"?{params}"
or
""
params
=
params
and
f
"?{params}"
or
""
dict_buttons
=
{
dict_buttons
=
{
"close"
:
"{window.location = '"
+
close_url
+
"'; return false;}"
,
"close"
:
"{window.location = '"
+
close_url
+
"'; return false;}"
,
"add"
:
"{window.location = o
%
sUri+'/add
%
s';}"
%
(
tableid
,
params
),
"add"
:
"{window.location = o
%
sUri+'/add
%
s';}"
%
(
tableid
,
params
),
"edit"
:
"""{
"edit"
:
"""{
if (m
%
sID) window.location = o
%
sUri+'/'+m
%
sID+'/edit
%
s';
if (m
%
sID) window.location = o
%
sUri+'/'+m
%
sID+'/edit
%
s';
...
@@ -216,6 +215,7 @@ class DeTable(field.Field):
...
@@ -216,6 +215,7 @@ class DeTable(field.Field):
filter_form
=
""
filter_form
=
""
field_index
=
0
field_index
=
0
filter_scripts
=
""
for
f
in
schema
:
for
f
in
schema
:
field_index
+=
1
field_index
+=
1
d
=
{
'data'
:
f
.
name
,
'title'
:
f
.
title
}
d
=
{
'data'
:
f
.
name
,
'title'
:
f
.
title
}
...
@@ -249,11 +249,11 @@ class DeTable(field.Field):
...
@@ -249,11 +249,11 @@ class DeTable(field.Field):
else
:
else
:
d
[
"action"
]
=
True
d
[
"action"
]
=
True
if
isinstance
(
f
.
widget
,
deform
.
widget
.
HiddenWidget
):
if
isinstance
(
f
.
widget
,
deform
_
widget
.
HiddenWidget
):
d
[
"visible"
]
=
False
d
[
"visible"
]
=
False
elif
isinstance
(
f
.
widget
,
deform
.
widget
.
CheckboxWidget
):
elif
isinstance
(
f
.
widget
,
deform
_
widget
.
CheckboxWidget
):
d
.
update
(
self
.
widget_checkbox
(
f
))
d
.
update
(
self
.
widget_checkbox
(
f
))
elif
isinstance
(
f
.
widget
,
deform
.
widget
.
SelectWidget
):
elif
isinstance
(
f
.
widget
,
deform
_
widget
.
SelectWidget
):
d
.
update
(
self
.
widget_select
(
f
))
d
.
update
(
self
.
widget_select
(
f
))
else
:
else
:
d
[
"wg_checkbox"
]
=
False
d
[
"wg_checkbox"
]
=
False
...
@@ -310,7 +310,7 @@ class DeTable(field.Field):
...
@@ -310,7 +310,7 @@ class DeTable(field.Field):
columns
.
append
(
d
)
columns
.
append
(
d
)
headers
.
append
(
f
.
title
)
headers
.
append
(
f
.
title
)
# cols2.append(data)
# cols2.append(data)
filter_scripts
=
self
.
get_filter_scripts
(
f
)
filter_scripts
=
self
.
get_filter_scripts
(
f
)
self
.
filter_scripts
=
filter_scripts
self
.
filter_scripts
=
filter_scripts
...
@@ -391,7 +391,7 @@ class DeTable(field.Field):
...
@@ -391,7 +391,7 @@ class DeTable(field.Field):
col_id
=
f
"{self.tableid}-{f.name}"
col_id
=
f
"{self.tableid}-{f.name}"
txt
=
f
'id="{col_id}" data-index={field_index} '
txt
=
f
'id="{col_id}" data-index={field_index} '
html
+=
'<div class="form-group">'
html
+=
'<div class="form-group">'
if
isinstance
(
f
.
widget
,
deform
.
widget
.
CheckboxWidget
):
if
isinstance
(
f
.
widget
,
deform
_
widget
.
CheckboxWidget
):
wg_check_val
=
[
f
.
widget
.
true_val
,
f
.
widget
.
false_val
]
wg_check_val
=
[
f
.
widget
.
true_val
,
f
.
widget
.
false_val
]
radio_val
=
[[
""
,
'Semua'
],
[
wg_check_val
[
0
],
'Aktif'
],
[
wg_check_val
[
1
],
'Pasif'
]]
radio_val
=
[[
""
,
'Semua'
],
[
wg_check_val
[
0
],
'Aktif'
],
[
wg_check_val
[
1
],
'Pasif'
]]
html
+=
'<label class="" for="'
+
col_id
+
'">'
+
f
.
title
+
'</label>'
html
+=
'<label class="" for="'
+
col_id
+
'">'
+
f
.
title
+
'</label>'
...
@@ -408,7 +408,7 @@ class DeTable(field.Field):
...
@@ -408,7 +408,7 @@ class DeTable(field.Field):
html
+=
f
'{radio_val[rdo][1]}</label>'
html
+=
f
'{radio_val[rdo][1]}</label>'
html
+=
'</label>'
html
+=
'</label>'
html
+=
'</div>'
html
+=
'</div>'
elif
isinstance
(
f
.
widget
,
deform
.
widget
.
SelectWidget
):
elif
isinstance
(
f
.
widget
,
deform
_
widget
.
SelectWidget
):
wg_select_val
=
f
.
widget
.
values
wg_select_val
=
f
.
widget
.
values
html
+=
f
'<select class="form-control {self.tableid}-control-filter"'
html
+=
f
'<select class="form-control {self.tableid}-control-filter"'
html
+=
f
'placeholder="{f.title}" {txt}/>'
html
+=
f
'placeholder="{f.title}" {txt}/>'
...
...
opensipkd/detable/templates/detable.pt
View file @
28b6bab
...
@@ -229,8 +229,10 @@
...
@@ -229,8 +229,10 @@
var param_data = "";
var param_data = "";
if (!${server_side}) {
if (!${server_side}) {
param_data = ${data};
param_data = ${data};
param_ajax = "";
} else {
} else {
param_ajax = o${tableid}Url;
param_ajax = o${tableid}Url;
param_data = [];
}
}
...
@@ -239,9 +241,9 @@
...
@@ -239,9 +241,9 @@
scrollY: ${field.scroll_y},
scrollY: ${field.scroll_y},
dom: '<"row"<"col-md-8"<"toolbar">Bl><"col-md-4"fr>>tip',
dom: '<"row"<"col-md-8"<"toolbar">Bl><"col-md-4"fr>>tip',
processing: true,
processing: true,
serverSide: ${server_side},
data: param_data,
data: param_data,
ajax: param_ajax,
ajax: param_ajax,
serverSide: ${server_side},
stateSave: ${state_save},
stateSave: ${state_save},
scrollCollapse: true,
scrollCollapse: true,
sort: ${sorts},
sort: ${sorts},
...
@@ -394,9 +396,9 @@
...
@@ -394,9 +396,9 @@
console.log(col_id, $(this).attr('id'), value);
console.log(col_id, $(this).attr('id'), value);
});
});
${structure: btnscripts}
filter_table();
filter_table();
</tal:block>
</tal:block>
${structure: btnscripts}
${structure: filter_scripts}
${structure: filter_scripts}
});
});
</script>
</script>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment