Changeset 777


Ignore:
Timestamp:
Feb 4, 2011, 3:16:35 AM (8 years ago)
Author:
gav
Message:

TaskProcedure? javascript improvements, childCount++ moved out of function and isNew is already set by GSP template.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/_maintenanceActions.gsp

    r776 r777  
    11<script type="text/javascript">
    2     var childCount = ${taskProcedureInstance?.maintenanceActions.size()} + 0;
     2    var ma_childCount = ${taskProcedureInstance?.maintenanceActions.size()} + 0;
    33    var ma_wrapperId = "ma_wrapper";
    44    var ma_cloneId = "maintenanceActionLazyList_clone";
     
    88
    99
    10     function addChild(wrapperId, cloneId, lazyList, fields, focusField){
     10    function addChild(wrapperId, cloneId, lazyList, fields, focusField, childCount){
    1111
    1212        var clone = jQuery("#"+cloneId).clone();
     
    1919            fieldsMap[field].attr('id',htmlId + field)
    2020                                        .attr('name',htmlId + field);
    21             if(field == 'isNew') {
    22                 fieldsMap[field].attr('value', 'true');
    23             }
    2421        });
    2522
     
    2724        clone.show();
    2825        fieldsMap[focusField].focus();
    29         childCount++;
    3026    }
    3127
    3228    // Click event on add button.
    3329    jQuery('.add-ma').live('click', function() {
    34             addChild(ma_wrapperId, ma_cloneId, ma_lazyList, ma_fields, ma_focusField);
     30        addChild(ma_wrapperId, ma_cloneId, ma_lazyList, ma_fields, ma_focusField, ma_childCount);
     31        ma_childCount++;
    3532    });
    3633
     
    5552
    5653    jQuery(window).load(function() {
    57         if(childCount == 0) {
    58             addChild(ma_wrapperId, ma_cloneId, ma_lazyList, ma_fields, ma_focusField);
     54        if(ma_childCount == 0) {
     55            addChild(ma_wrapperId, ma_cloneId, ma_lazyList, ma_fields, ma_focusField, ma_childCount);
     56            ma_childCount++;
    5957        }
    6058    });
Note: See TracChangeset for help on using the changeset viewer.