Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sd-doc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Skripnikov
sd-doc
Commits
3d862578
Commit
3d862578
authored
Nov 02, 2017
by
Valentin Skripnikov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-
parent
aa4ba7b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
157 additions
and
1 deletion
+157
-1
docs/_static/html/forms/widgets/dropdown.html
docs/_static/html/forms/widgets/dropdown.html
+100
-0
docs/forms/widgets-examples/dropdown.rst
docs/forms/widgets-examples/dropdown.rst
+46
-0
docs/forms/widgets.rst
docs/forms/widgets.rst
+11
-1
No files found.
docs/_static/html/forms/widgets/dropdown.html
0 → 100644
View file @
3d862578
<!DOCTYPE html>
<html>
<head
lang=
"en"
>
<meta
charset=
"UTF-8"
>
<title>
DropDown Widget
</title>
<script>
FORM_PLAYER_URL_PREFIX
=
"
http://192.168.3.16:8080/Synergy/
"
;
<!--
служебная
переменная
для
корректной
работы
компонента
"
HTD-редактор
"
-->
</script>
<link
rel=
"stylesheet"
href=
"http://192.168.3.16:8080/Synergy/js/form.player.css"
/>
<!--стандартный стиль компонентов формы-->
<script
src=
"http://192.168.3.16:8080/Synergy/js/vendor.js"
type=
"text/javascript"
></script>
<!--ссылка на сторонние библиотеки-->
<script
src=
"http://192.168.3.16:8080/Synergy/js/form.player.js"
type=
"text/javascript"
></script>
<!--ссылка на проигрыватель форм-->
</head>
<body>
<div
id=
"form_player_container"
>
<div
id=
"form_player_div"
></div>
</div>
<script>
'
use strict
'
;
AS
.
OPTIONS
.
locale
=
"
ru
"
;
AS
.
OPTIONS
.
coreUrl
=
"
http://192.168.3.16:8080/Synergy/
"
;
var
portal
=
{
player
:
null
,
/**
* очистить текущий проигрыватель форм
*/
clearPlayer
:
function
()
{
if
(
portal
.
player
)
{
portal
.
player
.
destroy
();
}
},
/**
* добавить новый проигрыватель форм
*/
createPlayer
:
function
(
formCode
)
{
portal
.
clearPlayer
();
portal
.
player
=
AS
.
FORMS
.
createPlayer
();
portal
.
player
.
showFormByCode
(
formCode
);
portal
.
player
.
view
.
setEditable
(
true
);
portal
.
player
.
view
.
appendTo
(
$
(
'
#form_player_div
'
));
AS
.
FORMS
.
bus
.
on
(
AS
.
FORMS
.
EVENT_TYPE
.
formShow
,
function
(
event
,
model
,
view
)
{
if
(
model
.
formCode
===
formCode
)
{
model
.
on
(
AS
.
FORMS
.
EVENT_TYPE
.
dataLoad
,
function
()
{
portal
.
main
(
portal
.
player
.
view
.
getViewWithId
(
"
textbox-cmp
"
),
portal
.
player
.
model
.
getModelWithId
(
"
textbox-cmp
"
));
});
}
});
},
main
:
function
(
view
,
model
)
{
$
(
"
[data-asformid='textbox.input.textbox-cmp']
"
).
click
(
function
()
{
var
values
=
[{
value
:
"
Queen
"
,
title
:
"
ROCK
"
},
{
value
:
"
Oxxxymiron
"
,
title
:
"
RAP
"
},
{
value
:
"
Филипп Киркоров
"
,
title
:
"
POP
"
}];
values
.
forEach
(
function
(
item
)
{
if
(
item
.
value
===
model
.
getValue
())
{
item
[
'
selected
'
]
=
true
;
}
});
AS
.
SERVICES
.
showDropDown
(
values
,
$
(
"
[data-asformid='textbox.input.textbox-cmp']
"
),
200
,
function
(
value
)
{
model
.
setValue
(
value
);
});
});
}
};
$
(
document
).
ready
(
function
()
{
AS
.
OPTIONS
.
login
=
"
admin
"
;
AS
.
OPTIONS
.
password
=
"
nimda
"
;
portal
.
createPlayer
(
"
sd-doc-widget-examples
"
);
});
</script>
</body>
</html>
docs/forms/widgets-examples/dropdown.rst
0 → 100644
View file @
3d862578
.. _widgets-examples-dropdown:
Пример использования AS.SERVICES.showDropDown
""""""""""""""""""""""""""""""""""""""""""""""""
.. raw:: html
<iframe src="../../_static/html/forms/widgets/dropdown.html" scrolling='no' frameBorder="0" height="200px" width="100%"></iframe>
Исходный код функции
.. code-block:: js
$("[data-asformid='textbox.input.textbox-cmp']").click(function () {
var values = [{
value: "Queen",
title: "ROCK"
}, {
value: "Oxxxymiron",
title: "RAP"
}, {
value: "Филипп Киркоров",
title: "POP"
}];
values.forEach(function (item) {
if (item.value === model.getValue()) {
item['selected'] = true;
}
});
AS.SERVICES.showDropDown(values,
$("[data-asformid='textbox.input.textbox-cmp']"),
200,
function (value) {
model.setValue(value);
});
});
}
Полный исходный код
.. literalinclude:: ../../_static/html/forms/widgets/dropdown.html
:language: html
:emphasize-lines: 63-89
:encoding: utf-8
docs/forms/widgets.rst
View file @
3d862578
...
@@ -17,7 +17,17 @@
...
@@ -17,7 +17,17 @@
.. js:function:: showDepartmentChooserDialog
.. js:function:: showDepartmentChooserDialog
.. js:function:: showDropDown
.. js:function:: AS.SERVICES.showDropDown(values, anchor, minWidth, callback)
Показать всплывающее окно с выбором элементов
:param Object values: массив элементов списка вида ``[{value : "value1", title : "title1", selected : true}, {value : "value2", title : "title2"}]``
:param HTMLElement anchor: якорный компонент, к которому следует привязать всплывающее окно
:param number minWidth: минимальная ширина всплывающего окна
:param Function callback: функция, которая будет вызвана после выбора элемента. В функцию будет
передан один параметр - значение выбранного элемента, тип ``string``
:ref:`widgets-examples-dropdown`
.. js:function:: showPositionChooserDialog
.. js:function:: showPositionChooserDialog
...
...
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