Quantcast
Channel: Editor — DataTables forums
Viewing all articles
Browse latest Browse all 3744

Dependent Firing Multiple Times

$
0
0

Is there anyway to stop or control how a dependent field is fired when the editor form initially opens? For example, I have two dependent fields in my form:

{
    label : 'Type:*',
    name : 'system_order_line.itemable_type',
    type : 'select',
}, {
    label : 'Item:*',
    name : 'system_order_line.itemable_id',
    type : 'select',
}, {
    label : 'Start date:',
    name : 'system_order_line.start_date',
    type : 'select',
}

The start_date options are dependent on the itemable_id options which are dependent on the itemable_type options like so:

editor_system_order_line_a.dependent( 'system_order_line.itemable_type', '/modules/DataTables/php/lib/Dependents/option.order_line_order_line_type_ids.php' );
editor_system_order_line_a.dependent( 'system_order_line.itemable_id', '/modules/DataTables/php/lib/Dependents/option.order_line_item_start_dates.php' );

When the form first opens this results immediately in 5 xhr requests to the server, like so:

XHR option.order_line_order_line_type_ids.php
XHR option.order_line_order_line_type_ids.php
XHR option.order_line_item_start_dates.php
XHR option.order_line_item_start_dates.php
XHR option.order_line_item_start_dates.php

It just seems really excessive and on a slow connection, i.e. mobile, could be problematic?


Viewing all articles
Browse latest Browse all 3744

Trending Articles