[CLOSED] Find non ExtJs Component and Set Value

  1. #1

    [CLOSED] Find non ExtJs Component and Set Value

    Hi
    I add a tinymce with text-area

    X.Panel()
        .Listeners(l => {
         l.AfterRender.Handler = "tinymce.init({selector:'textarea'});";
       })
        .Content(
       @<text>
        @Html.TextAreaFor(obj => obj.EmailBody, new { @class = "smallinput",  @style = "height: 200px; width: 100%;" })
        </text>)
    How I find this in client side and server side ?
    How I set or get value from it?

    I try
    var v=Ext.get('EmailBody')
            v.setHTML('123')
            console.log(v.getValue());
    but set and get not working.
    Last edited by Daniil; Jun 23, 2015 at 6:27 PM. Reason: [CLOSED]
  2. #2
    Hi @tinymce,

    If use TinyMCE with a regular <textarea> HTML element, what would be a way to get a value?
  3. #3
    Hi
    I not understand what you try to say.

    I think you doing a mistake
    Hi @tinymce
    should @matrixwebtech .

    Please try bellow sample ,I am trying to perform bellow operations

    Submit to server side

    I want to submit the value of tinymce with view-model ,but after submit the object value is null

    Set value with server side

    I want to set some content of the tinymce from server side but not working .

    Set value with client side script

    I think for that case value is set but not displayed .

    Get value with client side script

    not working properly ,I write some thing in tinymce and click on Get value with client side script button ,not getting the content .

    and also facing weird problem write some thing ,press F5 content is still there ,now press ctrl+F5 content disappeared , but think it should cleared when I press F5.

    <!DOCTYPE html>
    @model ERP_test.Controllers.tinymcecontent
    @{
        var X = Html.X();
    }
    <html>
    <head>
        <!-- CDN hosted by Cachefly -->
        <script src="//tinymce.cachefly.net/4.1/tinymce.min.js"></script>
        <script></script>
    </head>
    <body>
        @X.ResourceManager()
    
        @(
        X.FormPanel()
        .ID("f")
        .Items
        (
        X.Panel().Border(false)
        .Listeners(l =>
        {
            l.AfterRender.Handler = "tinymce.init({ selector: 'textarea' });";
        })
        .Content(
        @<text>
            @Html.TextAreaFor(obj => obj.content)
        </text>)
        
        )
        .Buttons
        (
        X.Button().Text("Submit to server side")
        .DirectEvents(de =>
        {
            de.Click.FormID = "f";
            de.Click.Action = "submit_to_server_side";
        })
        
         ,
        X.Button().Text("Set value with  server side")
        .DirectEvents(de =>
        {
            de.Click.FormID = "f";
            de.Click.Action = "set_value_with_server_side";
        })
        ,
     X.Button().Text("Set value with client side script")
        .Listeners(l=>
        {
            l.Click.Handler = @"var v=Ext.get('content')
                                    
                                    v.setValue('Temp value')
                                ";
        })
        ,
        X.Button().Text("Get value with client side script")
        .Listeners(l =>
        {
        l.Click.Handler = @"var v=Ext.get('content')
                    alert(v.getValue());
                ";
        })
        )
        )
    </body>
    </html>
    public class tinymceController : Controller
        {
            //
            // GET: /tinymce/
    
            public ActionResult Index()
            {
                tinymcecontent _tinymcecontent = new tinymcecontent();
                _tinymcecontent.content = "Ext.net";
                return View();
            }
            public void submit_to_server_side(tinymcecontent _tinymcecontent)
            {
    
            }
            public DirectResult set_value_with_server_side()
            {
                var v = X.Get("content");
                v.SetValue("value set from server side");
                return this.Direct();
            }
        }
        public class tinymcecontent
        {
            public string content { get; set; }
        }
    Last edited by matrixwebtech; May 31, 2015 at 1:51 PM.
  4. #4
    should @matrixwebtech
    Yes, it was a copy-paste error, sorry. I will edit.

    I not understand what you try to say.
    TinyMCE is designed to work with a <textarea> HTML element, not with a TextArea Ext.NET component.

    As well, Ext.NET TextArea component is not designed to work with a TinyMCE.

    A TextArea Ext.NET component renders a <textarea> HTML element. It is why this code is working:
    tinymce.init({ selector: 'textarea' });
    But after that operation I would not expect a TextArea Ext.NET component and its API working for 100%, because TinyMCE does something (personally, I don't know what exactly) with its underlying <textarea> HTML element.

    I guess reading this thread might help to understand better how to use a TextArea component with a TinyMCE.
    https://www.sencha.com/forum/showthread.php?198699
  5. #5
    I will read the sencha thread , but as of now can you please run my and sample and let me know why value not submitted to server side
  6. #6
    I will read the sencha thread
    Please clarify did it help to have some progress on the issue?
  7. #7
    Hi daniil

    Not much progress done .I am still trying with the plugin . apart from the plugin if you answer my questions one-by-one using my code that will be very helpful for me .
  8. #8
    Submit to server side

    I want to submit the value of tinymce with view-model ,but after submit the object value is null
    When you press the Submit button, nothing is being submitted to server. There are various reasons of that.

    I would recommend you to manually submit a value via a DirectEvent's ExtraParams.

    Set value with server side

    I want to set some content of the tinymce from server side but not working .

    Set value with client side script

    I think for that case value is set but not displayed .

    Get value with client side script

    not working properly ,I write some thing in tinymce and click on Get value with client side script button ,not getting the content .
    Ext.get('content').setValue() and Ext.get('content').getValue() doesn't work with a TinyMCE.

    You should find out a native TinyMCE API way to get/set a value, that I suggested in my first post on this thread. If I were more experienced in TinyMCE, I would help with pleasure, but I am not quite experienced in TinyMCE. it is rather a TinyMCE question, not Ext.NET.

Similar Threads

  1. [CLOSED] ExtJs How to gridpanel dynamic column add clone component ?
    By siyahgul in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 04, 2015, 1:41 PM
  2. Replies: 3
    Last Post: Apr 16, 2014, 4:53 PM
  3. [CLOSED] TreePanel component extjs 4.1
    By jesperhp in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 18, 2012, 5:53 AM
  4. [CLOSED] cannot find component even though they are declared.
    By RCM in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Mar 13, 2012, 1:23 PM
  5. [CLOSED] How to find the component which has the fous?
    By macap in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 12, 2010, 7:05 AM

Posting Permissions