Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Logic problem
Message
General information
Forum:
HTML5
Category:
Coding, syntax and commands
Title:
Miscellaneous
Thread ID:
01657073
Message ID:
01657083
Views:
39
UPDATE. Just changed this to

disable="!(justAdded || currentItem.iTmpnmId==0 || isNew)"

and all seems to be well.

Hi Boris,

It is a bit more complex than that. When I duplicate an item (but not yet saved), I want to be able to change its type and also adjust the template. This is how the newly duplicated (not yet saved) item looks like (for that duplicated item I set isDuplicate property to true, for new item isNew is true also - so in this case both flags are true):

My HTML code looks like this right now:
<ng-form name="editRetailForm" class="form-horizontal">

    <div class="col-xs-12">

        <div class="col-xs-3">
            <label class="control-label">@Labels.retailItemType</label>
            <select class="form-control" ng-model="currentItem.retailOption"
                    ng-change="retailOptionChange(currentItem)"
                    ng-disabled="currentItem.originalRetailOption!=0"
                    data-convert-to-number>
                <option value="0">@Labels.none</option>
                <option value="1">@Labels.tracking</option>
                <option value="2">@Labels.matrix</option>
            </select>
        </div>

        <div class="col-xs-4" ng-show="currentItem.retailOption==2">

            <label class="control-label">@Labels.matrixTemplateClass</label>

            <div data-sm-deeplink-dropdown="matrixMetaData.templateClasses"
                 data-ng-model="templateClassId"
                 disable="!(justAdded || currentItem.iTmpnmId==0)"
                 data-sm-dropdown-settings="matrixTemplateClassesSettings()"
                 data-sm-on-change="matrixTemplateClassChanged()"
                 data-sm-on-refresh="refreshMatrixMetaData()">
            </div>
        </div>

        <div class="col-xs-5" ng-show="currentItem.retailOption==2">

            <label class="control-label">@Labels.matrixTemplate</label>

            <div data-sm-deeplink-dropdown="matrixMetaData.templates"
                 data-ng-model="currentItem.iTmpnmId"
                 disable="!(justAdded || currentItem.iTmpnmId==0)"
                 data-sm-dropdown-settings="matrixTemplatesSettings()"
                 data-sm-on-change="matrixTemplateIdChanged()"
                 data-sm-on-refresh="refreshMatrixMetaData()">
            </div>
        </div>
    </div>

    <div class="col-xs-12" ng-if="!isNew && currentItem.retailOption==2">
        <div ng-if="currentMatrixTemplate" >
            <data-sm:matrix-grid row-attribute="currentMatrixTemplate.rowAttributeName"
                                 column-attribute="currentMatrixTemplate.columnAttributeName"
                                 rows="currentMatrixTemplate.templateRowValues"
                                 columns="currentMatrixTemplate.templateColumnValues"
                                 template-id="currentItem.iTmpnmId"
                                 item-id="currentItem.itemId"
                                 cell-selected="matrixAttributesChanged(rowValueId, columnValueId)">
            </data-sm:matrix-grid>
            <hr/>
        </div>
        <div ng-if="rowValueId && columnValueId">
            @Html.Partial("EditRetailMatrix")
        </div>
    </div>
    <div class="col-xs-12">
        <div class="row dci-item-retail-domhook" ng-if="currentItem.retailOption==1">
            @Html.Partial("EditRetailTracking")
        </div>
    </div>
I think I need to adjust some things at the top.

>>Hi everybody,
>>
>>I'm a bit confused and may use some help.
>>
>>Here is my current condition:
>>
>>disable="!justAdded && currentItem.iTmpnmId>0"
>>
>>
>>What I actually want - if it's a newly added item (e.g. justAdded = true), I want to be able to change it, so disable should be false.
>>
>>If it's not a just added new item, then I only want to allow to change it if the Id is not yet set.
>>
>>How should I express my logic correctly - since we have disable option in HTML I'm confused with double negative.
>>
>>Thanks in advance.
>
>
>
>disable = "!(justAdded || currentItem.iTmpnmId==0)"
>
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform