Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
e1a6efb0
Commit
e1a6efb0
authored
Jun 03, 2015
by
Jos Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ui) add rowtoggle to bootgrid wrapper
parent
25cd08a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
opnsense_bootgrid_plugin.js
src/opnsense/www/js/opnsense_bootgrid_plugin.js
+31
-3
No files found.
src/opnsense/www/js/opnsense_bootgrid_plugin.js
View file @
e1a6efb0
...
...
@@ -40,16 +40,28 @@ function stdBootgridUI(obj, sourceUrl) {
rowCount
:[
7
,
14
,
20
,
-
1
],
url
:
sourceUrl
,
formatters
:
{
"
commands
"
:
function
(
column
,
row
)
{
"
commands
"
:
function
(
column
,
row
)
{
return
"
<button type=
\"
button
\"
class=
\"
btn btn-xs btn-default command-edit
\"
data-row-id=
\"
"
+
row
.
uuid
+
"
\"
><span class=
\"
fa fa-pencil
\"
></span></button>
"
+
"
<button type=
\"
button
\"
class=
\"
btn btn-xs btn-default command-delete
\"
data-row-id=
\"
"
+
row
.
uuid
+
"
\"
><span class=
\"
fa fa-trash-o
\"
></span></button>
"
;
},
"
rowtoggle
"
:
function
(
column
,
row
)
{
if
(
parseInt
(
row
[
column
.
id
],
2
)
==
1
)
{
return
"
<span class=
\"
fa fa-check-square-o command-toggle
\"
data-value=
\"
1
\"
data-row-id=
\"
"
+
row
.
uuid
+
"
\"
></span>
"
;
}
else
{
return
"
<span class=
\"
fa fa-square-o command-toggle
\"
data-value=
\"
0
\"
data-row-id=
\"
"
+
row
.
uuid
+
"
\"
></span>
"
;
}
}
}
}).
on
(
"
loaded.rs.jquery.bootgrid
"
,
function
(
e
)
{
// scale footer on resize
$
(
this
).
find
(
"
tfoot td:first-child
"
).
attr
(
'
colspan
'
,
$
(
this
).
find
(
"
th
"
).
length
-
1
);
$
(
this
).
find
(
'
tr[data-row-id]
'
).
each
(
function
(){
if
(
$
(
this
).
find
(
'
[class*="command-toggle"]
'
).
first
().
data
(
"
value
"
)
==
"
0
"
)
{
$
(
this
).
addClass
(
"
text-muted
"
);
}
});
})
return
grid
;
...
...
@@ -132,6 +144,21 @@ $.fn.UIBootgrid = function (params) {
console
.
log
(
"
action del missing
"
)
}
}).
end
();
// toggle item
grid
.
find
(
"
.command-toggle
"
).
on
(
"
click
"
,
function
(
e
)
{
if
(
gridParams
[
'
toggle
'
]
!=
undefined
)
{
var
uuid
=
$
(
this
).
data
(
"
row-id
"
);
ajaxCall
(
url
=
gridParams
[
'
toggle
'
]
+
uuid
,
sendData
=
{},
callback
=
function
(
data
,
status
){
// reload grid after delete
$
(
"
#
"
+
gridId
).
bootgrid
(
"
reload
"
);
});
}
else
{
console
.
log
(
"
action toggle missing
"
)
}
}).
end
();
});
// link Add new to child button with data-action = add
...
...
@@ -146,7 +173,7 @@ $.fn.UIBootgrid = function (params) {
clearFormValidation
(
'
frm_
'
+
editDlg
);
});
// show dialog for
pipe
edit
// show dialog for edit
$
(
'
#
'
+
editDlg
).
modal
({
backdrop
:
'
static
'
,
keyboard
:
false
});
//
$
(
"
#btn_
"
+
editDlg
+
"
_save
"
).
unbind
(
'
click
'
).
click
(
function
(){
...
...
@@ -187,3 +214,4 @@ $.fn.UIBootgrid = function (params) {
}
}));
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment