-
Notifications
You must be signed in to change notification settings - Fork 13
/
XEditableCheckList.php
102 lines (86 loc) · 2.55 KB
/
XEditableCheckList.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* XeditableText class file.
*
* @author Marcio Camello <[email protected]>
* @link http://
* @copyright Copyright © Marcio Camello 2014
* @version 1.5.1
*/
namespace mcms\xeditable;
class XEditableCheckList extends XEditable
{
/**
* @see Xeditable
* @var string
* Type of input. select
*/
public $type = 'checklist';
/**
* @see XEditable
* @var boolean
* If true - html will be escaped in content of element via $.text() method.
* If false - html will not be escaped, $.html() used.
* When you use own display function, this option obviosly has no effect.
*/
public $escape = true;
/**
* @see XEditable
* @var string
* CSS class automatically applied to input
*/
public $inputclass = null;
/**
* @see XEditable
* @var string | array | object | function
* Data automatically prepended to the beginning of dropdown list.
*/
public $prepend = false;
/**
* @see XEditable
* @var string
* Separator of values when reading from data-value attribute
*/
public $separator = false;
/**
* @see XEditable
* @var string | array | object | function
* Source data for list.
* If array - it should be in format: [{value: 1, text: "text1"}, {value: 2, text: "text2"}, ...]
* For compability, object format is also supported: {"1": "text1", "2": "text2" ...} but it does not guarantee elements order.
*
* If string - considered ajax url to load items. In that case results will be cached for fields with the same source and name. See also sourceCache option.
*
* If function, it should return data in format above (since 1.4.0).
*
* Since 1.4.1 key children supported to render OPTGROUP (for select input only).
* [{text: "group1", children: [{value: 1, text: "text1"}, {value: 2, text: "text2"}]}, ...]
*/
public $source = null;
/**
* @see XEditable
* @var boolean
* if true and source is string url - results will be cached for fields with the same source.
* Usefull for editable column in grid to prevent extra requests.
*/
public $sourceCache = true;
/**
* @see XEditable
* @var string
* Error message when list cannot be loaded (e.g. ajax error)
*/
public $sourceError = null;
/**
* @see XEditable
* @var object|function
* Additional ajax options to be used in $.ajax() when loading list from server.
* Useful to send extra parameters (data key) or change request method (type key).
*/
public $sourceOptions = null;
/**
* @see XEditable
* @var string
* HTML template of input. Normally you should not change it.
*/
public $tpl = '<div></div>';
}