Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1355
Difference property from igTextEditor, igNumericEditor, igDatePicker
posted

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!

Parents
No Data
Reply
  • 10685
    Verified Answer
    Offline posted

    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.

Children