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

Clearing the control IDs of an Input Manager settings collection

5 Answers 45 Views
Input
This is a migrated thread and some comments may be shown as answers.
towpse
Top achievements
Rank 2
towpse asked on 10 Sep 2009, 07:02 PM
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.

5 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 11 Sep 2009, 07:51 AM
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.
0
towpse
Top achievements
Rank 2
answered on 11 Sep 2009, 03:04 PM

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.

 

0
Accepted
Dimo
Telerik team
answered on 14 Sep 2009, 10:56 AM
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.
0
towpse
Top achievements
Rank 2
answered on 14 Sep 2009, 01:22 PM
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.
0
Accepted
Dimo
Telerik team
answered on 14 Sep 2009, 02:04 PM
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.
Tags
Input
Asked by
towpse
Top achievements
Rank 2
Answers by
Dimo
Telerik team
towpse
Top achievements
Rank 2
Share this question
or