Announcement

Collapse
No announcement yet.

custom.tpl get value in context

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • custom.tpl get value in context

    Hi,

    how i can get value of viewObject.options.entityType​ in the {{each}} context ?

    Thanks

    PHP Code:
    <div class="margin-bottom">
        <
    p>{{viewObject.options.entityType}}</p// NOT EMPTY
        
    <p>{{viewObject.options.entityId}}</p// NOT EMPTY
    </div>
    <
    div>
        <
    table width='100%'>
            <
    tr>
                <
    td width='70%'>nomenclature</td>
                <
    td width='10%'>amount</td>
                <
    td width='20%'>nomenCode</td>
            </
    tr>
        </
    table>
    </
    div>
    <
    br />
    <
    div>
        {{
    #each viewObject.nomenclatureDataList}}
        
    <span title='{{tooltip}}'>
        <
    table width='100%'>
            <
    tr>
                <
    td width='70%'>
                    <
    button
                        
    class="action btn btn-warning btn-x-wide"
                        
    type="button"
                        
    data-action="setCare"
                        
    data-entity-type="{{viewObject.options.entityType}}" // <==== EMPTY
                        
    data-entity-id="{{viewObject.options.entityId}}" // <==== EMPTY
                        
    data-nomenclature-id="{{nomenclatureId}}"
                        
    data-nomen-code="{{nomenCode}}"
                        
    data-amount-base="{{amount}}"
                        
    data-profession-id="{{professionId}}"
                        
    data-profession-name="{{professionName}}"
                    
    >
                    {{
    nomenclatureName}}
                    </
    button>
                </
    td>
                <
    td width='10%'>
                    {{
    amount}}
                </
    td>
                <
    td width='20%'>
                    <
    a href='#Nomenclature/view/{{nomenclatureId}}' target='_blank'>{{nomenCode}}</a>
                </
    td>    
                    {{
    #if selected}}<span class="check-icon fas fa-check" style="vertical-align: middle; margin: 0 10px;"></span>{{/if}}
            
    </tr>
        </
    table>
        </
    span>
        {{/
    each}}
        
    </
    div>
    <
    br/>
    <
    div class="margin-bottom">
    </
    div>​ 

  • #2
    Hi item

    try this:

    PHP Code:
                        data-entity-type="{{../options @index 'entityType'}}" 
                        
    data-entity-id="{{../options @index 'entityId'}}" ​ 
    Not tested but should work if the structure of viewObject is something like this:
    Code:
    viewObject = {
        nomenclatureDataList: {
            nomenclatureId: "some value a",
            nomenCode: "some value b",
            amount: "some value c",
            professionId: "some value d",
            professionName: "some value e",
        },
        options: {
            entityType: "some value f",
            entityId: "some value g"
        }
    }
    Best Regards

    Comment


    • #3
      Thank telecastg

      you directed me always good direction

      solution ".../" go outside context of each

      PHP Code:
      {{../viewObject.options.entityType}} 

      Comment


      • esforim
        esforim commented
        Editing a comment
        What are you cooking? Look tasty

      • item
        item commented
        Editing a comment
        lol espcrm,
        i think i have a new field type revolutionary in this world... i will give his name IA (AI in english !?)
        Of course, without Yuri and EspoCRM, it can't be possible... i just have the "idea" and use the power of EspoCRM.

        other CRM can play in a "sand-box with short and feeding bottle"
    Working...
    X