depends_on -> dependsOn

This commit is contained in:
Samuel Georges 2015-01-03 10:04:06 +11:00
parent 433c4c07ff
commit a6259ff915
3 changed files with 19 additions and 14 deletions

View File

@ -56,6 +56,10 @@ class ServiceProvider extends ModuleServiceProvider
$manager->registerFormWidget('Backend\FormWidgets\DataGrid', [
'label' => 'Data Grid',
'code' => 'datagrid'
]); // @drepcated
$manager->registerFormWidget('Backend\FormWidgets\DataTable', [
'label' => 'Data Table',
'code' => 'datatable'
]);
$manager->registerFormWidget('Backend\FormWidgets\RecordFinder', [
'label' => 'Record Finder',

View File

@ -144,19 +144,19 @@ If the `options` element is not presented in the configuration, the options will
**TODO:** Document the AJAX interface
The drop-down options could depend on other columns. This works only with AJAX-based drop-downs. The column a drop-down depends on are defined with the `depends_on` property:
The drop-down options could depend on other columns. This works only with AJAX-based drop-downs. The column a drop-down depends on are defined with the `dependsOn` property:
state:
title: State
type: dropdown
depends_on: country
dependsOn: country
Multiple fields are allowed as well:
state:
title: State
type: dropdown
depends_on: [country, language]
dependsOn: [country, language]
**Note:** Dependent drop-down should always be defined after their master columns.
@ -187,9 +187,9 @@ Columns are defined as array with the `columns` property. The array keys corresp
- `title`
- `type` (string, checkbox, dropdown, autocomplete)
- `width` - sets the column width, can be specified in percents (10%) or pixels (50px). There could be a single column without the width specified. It will be stretched to take the available space.
- `readonly`
- `readOnly`
- `options` (for drop-down elements and autocomplete types)
- `depends_on` (from drop-down elements)
- `dependsOn` (from drop-down elements)
## Events

View File

@ -230,7 +230,7 @@
DropdownProcessor.prototype.createOptionsCachingKey = function(row) {
var cachingKey = 'non-dependent',
dependsOn = this.columnConfiguration.depends_on
dependsOn = this.columnConfiguration.dependsOn
if (dependsOn) {
if (typeof dependsOn == 'object') {
@ -277,8 +277,7 @@
DropdownProcessor.prototype.onItemClick = function(ev) {
var target = this.tableObj.getEventTarget(ev)
if (target.tagName == 'LI')
{
if (target.tagName == 'LI') {
this.updateCellFromSelectedItem(target)
var selected = this.findSelectedItem()
@ -349,11 +348,11 @@
// Determine if this drop-down depends on the changed column
// and update the option list if necessary
if (!this.columnConfiguration.depends_on)
if (!this.columnConfiguration.dependsOn)
return
var dependsOnColumn = false,
dependsOn = this.columnConfiguration.depends_on
dependsOn = this.columnConfiguration.dependsOn
if (typeof dependsOn == 'object') {
for (var i = 0, len = dependsOn.length; i < len; i++ ) {
@ -362,8 +361,10 @@
break
}
}
} else
}
else {
dependsOnColumn = dependsOn == columnName
}
if (!dependsOnColumn)
return
@ -372,9 +373,9 @@
viewContainer = this.getViewContainer(cellElement)
this.fetchOptions(cellElement, function rowValueChangedFetchOptions(options) {
var value = options[currentValue] !== undefined ?
options[currentValue] :
'...'
var value = options[currentValue] !== undefined
? options[currentValue]
: '...'
viewContainer.textContent = value
viewContainer = null