Difference property from igTextEditor, igNumericEditor, igDatePicker

Answered (Verified) This post has 1 verified answer | 4 Replies | 4 Followers Thread's RSS feed.

Cuong Tran
Points 1,355
Replied On: Fri, Jan 15 2016 4:29 AM Reply

Hello!

I want create function that can set readonly for all editor type by 1 function

but i can not differentiate from igTextEditor, igNumericEditor, igDatePicker

sample

function SetReadOnlyForEditor(editorName){

if (isTextEditor)

$(editorName).igTextEditor("option","readOnly",true);

}else if(isNumericEditor){

$(editorName).igNumericEditor("option","readOnly",true);

}else

{

$(editorName).igDatePicker("option","readOnly",true);

}

On 14.2 version to prevous. You use 1 function to set readonly for editor($(name).igEditor("option","readonly",true))

But now, 15.2 version. You split it to 3 function igTextEditor, igNumericEditor, igDatePicker . So my function has not working

:(

thanks you very much!

  • Post Points: 50

Verified Answer

[Infragistics] Ivaylo
Points 10,535
Infragistics Employee
Answered (Verified) Replied On: Fri, Jan 15 2016 8:51 AM Reply
Verified by Cuong Tran

Hello,

You are correct. It is no longer an option to use igEditor in order to reference all types of IgniteUI editors and update properties, etc. I suggest it could be helpful to name the editor container elements based on the editor to be instantiated upon them and thus having the editor type in the editorName so further processing could be done in the function SetReadOnlyForEditor(editorName){}.  

In case you would like to not couple the functionality with the container names, then I suggest you could check the editor type using data function. For example in case you have an igTextEditor, it is possible to access the object using

$("#editorName ").data("igTextEditor");

If there is no igTextEditor instantiated on the #editorName , it will return undefined, so it is an option to check the type of editor and still use the correct syntaxes to change the editor options.

For example you could use a similar to the following function:

        function SetReadOnlyForEditor(editorName) {
            var editor = $("#editorName").data();
            if (editor.igTextEditor) { window.alert("text editor") //use $(#editorName
).igTextEditor("option","readOnly",true);
            }
            if (editor.igNumericEditor) {
                 window.alert("Numeric Editor") //use $(#editorName
).igNumericEditor("option","readOnly",true); 
             }
         //...etc
        }
I expect these will help you achieve your requirements.

Sincerely,
Ivaylo Ganchev
Software Developer
Infragistics, Inc.
http://www.infragistics.com/support

  • Post Points: 20

All Replies

[Infragistics] Ivaylo
Points 10,535
Infragistics Employee
Answered (Verified) Replied On: Fri, Jan 15 2016 8:51 AM Reply
Verified by Cuong Tran

Hello,

You are correct. It is no longer an option to use igEditor in order to reference all types of IgniteUI editors and update properties, etc. I suggest it could be helpful to name the editor container elements based on the editor to be instantiated upon them and thus having the editor type in the editorName so further processing could be done in the function SetReadOnlyForEditor(editorName){}.  

In case you would like to not couple the functionality with the container names, then I suggest you could check the editor type using data function. For example in case you have an igTextEditor, it is possible to access the object using

$("#editorName ").data("igTextEditor");

If there is no igTextEditor instantiated on the #editorName , it will return undefined, so it is an option to check the type of editor and still use the correct syntaxes to change the editor options.

For example you could use a similar to the following function:

        function SetReadOnlyForEditor(editorName) {
            var editor = $("#editorName").data();
            if (editor.igTextEditor) { window.alert("text editor") //use $(#editorName
).igTextEditor("option","readOnly",true);
            }
            if (editor.igNumericEditor) {
                 window.alert("Numeric Editor") //use $(#editorName
).igNumericEditor("option","readOnly",true); 
             }
         //...etc
        }
I expect these will help you achieve your requirements.

Sincerely,
Ivaylo Ganchev
Software Developer
Infragistics, Inc.
http://www.infragistics.com/support

  • Post Points: 20
Cuong Tran
Points 1,355
Replied On: Wed, Jan 20 2016 4:18 AM Reply

Thank you very much! Ivaylo

It is very comfortable with my question and very helpful. it works fine for me!

Thanks again! 

  • Post Points: 5
Mehndi
Points 5
Replied On: Tue, Jul 11 2017 3:20 AM Reply

Thanks for sharing this useful information it really helped me lot and check some awesome mehndi designs here.

  • Post Points: 5
Page 1 of 1 (5 items) | RSS