Setting recurrance messages from variable

2 posts, 0 answers
  1. Rob
    Rob avatar
    59 posts
    Member since:
    Jan 2012

    Posted 26 Oct Link to this post

    Hi Guys

    I'm sure this is just a syntax issue.. but I'm stuffed if I can work it out. 

    If I set my messages ( for testing only) like this in the editor template it works fine.

    <div data-container-For="recurrenceRule" Class="k-edit-field">
        <div data-bind="value:recurrenceRule" name="recurrenceRule" data-role="recurrenceeditor" data-frequencies="['never','daily','weekly']" data-messages="{'frequencies':{'never':'Nie','daily':'Täglich','weekly':'Wöchentlich','monthly':'Monatlich','yearly':'Jährlich'}}"></div>
    </div>

     

    But if I try to set the data-messages to a javascript variable I can't get it to work. ( I wan't to do this as I want to be able to change the language based on the browser language.. so I want to have an externally defined message object.)

    I've tried all sorts of ways to define the variable.. but it never works

      var rmessages = {'frequencies':{'never':'Nie','daily':'Täglich','weekly':'Wöchentlich','monthly':'Monatlich','yearly':'Jährlich'}};
      // var rmessages  = {frequencies:{never:"Nie",daily:"Täglich",weekly:"Wöchentlich",monthly:"Monatlich",yearly:"Jährlich"}};
     
    //-------------------------------
    <div data-container-For="recurrenceRule" Class="k-edit-field">
            <div data-bind="value:recurrenceRule" name="recurrenceRule" data-role="recurrenceeditor" data-frequencies="['never','daily','weekly']" data-messages="rmessages"></div>
        </div>

     

    When I run , it seems that the data-messages are set to 'rmessages'  ( as per the attached image) however is other parts of the same template I refer to javascript variable and this works. ( e.g setting the  'data-source' for this drop down which is on the same template.

    <div id="selectsg" style="display:none;">
           <div Class="k-edit-label"><label for="SGIDId">Queue</label></div>
           <div data-container-For="SGID" Class="k-edit-field">
               <input name="SGIDId" type="text" id="SGIDId" data-role="combobox" data-source="sgdataSource" data-text-field="name" data-value-field="id" data-bind="value:SGID" data-placeholder="Select Queue..." data-value-primitive="true" />
           </div>
       </div>

     

    Can someone please point out my stupid error in syntax or thinking!  

    Many thanks

    Rob

     

     

     

    asdad

     

  2. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    278 posts

    Posted 28 Oct Link to this post

    Hello Rob,

    I am afraid that the editor template, would not allow you to achieve the required implementation. However, as this scenario could be also applicable in other projects too, I would suggest you to log a Feature request in our Feedback portal.

    Regards,
    Veselin Tsvetanov
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top