How to check Contains value in Presenter

Posted by: arulventhan.palanimuthu on 10 September 2018, 2:59 am EST

    • Post Options:
    • Link

    Posted 10 September 2018, 2:59 am EST

    Hi,

    How to check contains value in presenter while binding

    for example,

    presenter: '<span  class="text-ellipsis"  style="padding: 4px;min-height:26px;max-height:30px;width: 100%;left: 0;margin: 0 !important;float: right;font-size:' + fontSize + 'px;background-color:{{=it.backColor}}">{{=it.' + ColumnName + '}}</span>',
    

    in above code i need to check that ColumnName contains ‘www’ or not.

    Thanks,

    Arulventhan NP

  • Posted 11 September 2018, 12:42 am EST

    Hi Arul,

    You can use the code as follows:

    var colObj = dataView.columns[hitColumnIndex];

    var text =colObj.caption;

    Then you can check whether ‘text’ contains ‘www’ or not.

    Thanks,

    Deepak Sharma

  • Posted 12 September 2018, 8:35 pm EST

    Hi Sharma,

    I need this option while binding a grid

    
     n = {
                                            id: ColumnId,
                                            caption: ColumnHeader,
                                            dataField: ColumnName,
                                            width: _width,
                                            presenter: '<span  class="text-ellipsis" title="{{=it.' + ColumnName + '}}" style="padding: 4px;min-height:26px;max-height:30px;width: 100%;left: 0;margin: 0 !important;float: right;font-size:' + fontSize + 'px;background-color:{{=it.Color}}">{{=it.' + ColumnName + '}}</span>', 
                                        }
    
    

    While binding the grid i need to check that column has ‘www’. If it has i need to change the presenter as hyperlink else it as span.

    Is there any method to check as follows

    
    {{(? it.ColumnName).indexOf('www') !== -1}}'' {{??}}=it' + ColumnName {{?}}
    
    

    Thanks,

    Arulventhan NP

  • Posted 18 September 2018, 2:04 am EST

    Hi Arulventhan,

    You could store the presenter in a variable based on the condition and then set it to the Column’s presenter option. Something like explained below:

    http://help.grapecity.com/spread/SpreadViews/tutorial-Adding%20Column%20Presenters.html

    Thanks

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels