Clearing the control IDs of an Input Manager settings collection

6 posts, 2 answers
  1. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 10 Sep 2009 Link to this post

    I have a UI that changes dynamically.
    Every time it changes I'm adding new controls to the appropriate settings in my Input manager.

    For example, a user selects an item from a drop down.
    I clear the UI and reload it.
    I see that I need to expose
    • 2 numeric setting text boxes
    • 1 alpha numeric text box
    • 1 date time text box
    I generate Ids for those elements and add them to their respective input setting.
    which is done something like this, for each type of setting i may have (date, numeric, text etc)
               //get all datetime data format text boxes and convert them into datetimes 
                elements = $('input.datetime', context); //find my date inputs within the given context 
                var dateSettings = $find('RadInputManager').get_inputSettings('DateTimeSettings'); 
                generateInputIds(elements); //generates unique ids for the found fields 
                for (var idx = 0; idx < elements.length; ++idx) { 
                    dateSettings.addTargetInput(elements[idx].id); 
                } 

    As the UI keeps changing and I keep adding Ids to the various input settings collections, the target input Id collections will get larger and larger and the settings collections will have references to Ids for elements that no longer exist on the UI.

    I'm wondering if there is a standard way to clear the target input Ids collections.

    Regards.
  2. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 11 Sep 2009 Link to this post

    Hello Matt,

    You can access the collection of target input IDs via

    InputMgrInstance.get_inputSettings("BehaviorID").get_targetControlIDs()

    This is an array object, so you can modify it by using the standard Javascript API.

    Greetings,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 11 Sep 2009 Link to this post

    Right.
    But if I look at the contents of im.get_inputSettings("MySettings").get_targetControlIDs() I see the hidden dummy control that I used as the default target control Id in my makrup.

    I.E

                <TargetControls> 
                    <telerik:TargetInput ControlID="dummy1" /> 
                </TargetControls> 

    This will get cleared if I reset/clear that array. I don't think I want to do that do I? I think I always need at least that dummy control in there? I'm doing all my work client-side.

    Also I can't assign anything to the result of a function call apparently.
    Cannot do im.get_inputSettings("MySettings").get_targetControlIDs()  = [ ];

    Also this doesn't seem to wrok either:

    arr = im.get_inputSettings("NumericSettings").get_targetControlIDs();

    arr = [];

    arr becomes what I expect it to but after I clear arr, im.get_inputSettings("NumericSettings").get_targetControlIDs(); still has items.


    Regards.

     

  5. Answer
    Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 14 Sep 2009 Link to this post

    Hi Matt,

    Well, indeed, you need to clear the field itself, not the getter:

    InputMgrInstance.get_inputSettings("BehaviorID")._targetControlIDs

    As for the dummy ID, you can leave it there or add it again after clearing. It depends on how you manipulate the ID collection. However, if you decide to add it after clearing, this should not be done via the addTargetInput method, but manually and directly in the _targetControlIDs collection.

    Regards,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 14 Sep 2009 Link to this post

    Thanks Dimo. That makes sesne.

    Now one more thing. When I clear those _targetControlIds collections, I am remvoing the initial dummy target controls that I had setup int he markup. I tired to run the application without manually reinserting those dummy controls and without them it seems to function as expected with no problems.

    I'm wondering if the dummy controls are just there to assist with the client initialization of the input manager and its behaviour settings. Perhaps I need not conecrn myself with reinserting those dummy controls when clearing the taget Control collections.

    Any comments?

    regards.
  7. Answer
    Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 14 Sep 2009 Link to this post

    Matt,

    In case you are manipulating the targetControlIDs collection client-side only, there should be no need to reinsert the dummy ID. It is necessary for the initial intialization of the control on the server.

    Sincerely yours,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017