This is a migrated thread and some comments may be shown as answers.

MVVM - Attribute binding

7 Answers 348 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Neeraj
Top achievements
Rank 1
Veteran
Neeraj asked on 06 Feb 2018, 06:15 AM
Hello, have template as shown below:

Remote template:

<script id="AirPricingWithoutPNRViewModelItemTemplate" type="text/x-kendo-template">
     <div class="postpricingItem">
        <div>
            <table>
                <tbody data-template="T2Template" data-bind="source: data"></tbody>
            </table>
        </div>
        <div>Quote: <span data-bind="text: Total"></span></div>  /* attr: title to be attached to this span */
    </div>
</script>

I want the Quote element span to have 'title' attribute binding to format as in T1Template  So that on hover  can see details.



child Template:

    <script id="T1Template" type="text/x-kendo-template">
        
                <tr>
                    <td>TST </td>
                    <td title="Passenger Type" data-bind="text: UnitQualifier"></td>
                    <td title="Passenger Quantity" data-bind="text: Quantity"></td>
                    <td title="PricingPCC" data-bind="text: OptionFilters.PricingPccInformation.PCCCode"></td>
                    #if (data.lkpStatus=="D") {#
                    <td title="Deleted TST"><i class="fa text-danger fa-times" aria-hidden="true"></i></td>
                    #} else {#
                    #}#
                    <td title="Price" data-bind="text: TotalSalesPriceToDisplay"></td>
                </tr>
          
    
</script>





7 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 07 Feb 2018, 12:41 PM
Hello Neeraj,

Based on the provided information I assume that the requirement is to bind the title attribute of the Quote element to some value from the view model. Please correct me if I am wrong.

A possible solution is to use the Attribute Binding.

e.g.

<span data-bind="attr:{title:Total},text:Total"></span></div>

Below you will find a sample which demonstrates the above solution:



More detailed information about Attribute Binding can be found in the documentation:



Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Neeraj
Top achievements
Rank 1
Veteran
answered on 08 Feb 2018, 09:15 AM
Hello Georgi,  The data to be to not plain text. I want to bind  to  it might have some bold color change etc
0
Georgi
Telerik team
answered on 12 Feb 2018, 07:47 AM
Hi Neeraj,

I apologize but I am not sure that I understand the requirement. 

Could you please provide me with more detailed information about the required result and the use case?

I look forward to your reply.
 

Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Neeraj
Top achievements
Rank 1
Veteran
answered on 13 Feb 2018, 01:00 AM
Hello, Open this link below. It contains that want. I want to bind property to Title attribute has content that want to render properly
http://dojo.telerik.com/AYiRe/2
0
Neeraj
Top achievements
Rank 1
Veteran
answered on 13 Feb 2018, 01:01 AM
if above link work: http://dojo.telerik.com/AYiRe/2
0
Neeraj
Top achievements
Rank 1
Veteran
answered on 13 Feb 2018, 01:02 AM
if above link work : http://dojo.telerik.com/AYiRe/2
0
Georgi
Telerik team
answered on 14 Feb 2018, 03:16 PM
Hi Neeraj,

The default title tooltip does not support HTML.

A possible workaround is to use Kendo Tooltip:


More information about the Kendo Tooltip can be found in the documentation:



Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
MVVM
Asked by
Neeraj
Top achievements
Rank 1
Veteran
Answers by
Georgi
Telerik team
Neeraj
Top achievements
Rank 1
Veteran
Share this question
or