We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33238
    • 388 Posts
    Hello everyone.

    I've been looking for some way to delete html labels and limit the quantity of characters from the MIGX tables on the back-end.

    I'm using pure and plain MIGX, no MIGXdb or any other configuration.

    TV: *dynamicContent
    input Type: Migx

    Form Tabs:
    [
    	{"caption":"Text", "fields": 
    		[
    		 {"field":"title","caption":"Title"}
    		,{"field":"description","caption":"Content","inputTVtype":"richtext"}
    		]
    	}
    ]


    Grid Columns:

    [
    	 {"header": "Title", "width": "50", "sortable": "true", "dataIndex": "title"}
    	,{"header": "Text Content", "width": "100", "sortable": "true", "dataIndex": "description"}
    ]
    


    Technically the problematic field is the richtext, I need on the Grid Columns delete all HTML labels, show only plain text and max 150 characters.
    It's possible?

    Click on the link yo see what is displaying right now.

    https://drive.google.com/file/d/0B4qE5lYwheXbQ200OXk5dnNRYkE/view?usp=sharing

    Thank you very much for any help.

    This question has been answered by Bruno17. See the first response.

    [ed. note: Ysanmiguel last edited this post 7 years, 4 months ago.]
      --
      ysanmiguel.com
      • 46073
      • 65 Posts
      You could use a chunk-renderer for this column.
      Create one renderOption for this renderer and set the name-field in that renderOption to a chunk name.

      In this chunk you can format the output of the column, for example:

      [[+description:striptags]]


        • 33238
        • 388 Posts
        Quote from: rgliberty at Jul 17, 2017, 03:08 PM
        You could use a chunk-renderer for this column.
        Create one renderOption for this renderer and set the name-field in that renderOption to a chunk name.

        In this chunk you can format the output of the column, for example:

        [[+description:striptags]]



        Hello mate, thank you for your help.

        I just tried what you told me:

        - In the Columns tab I Edit the field
        - In the render tab in the Render dropdown I selected this.renderChunk
        - In the field renderChunk template I enter the : [[+description:striptags]]

        What is happening now is that the render looks right, but it's modifying the input field too.
        let me explain you.

        If I enter in the richtext area <h1>Title</h1> <p>text here</p>
        then, in teh columns the render will looks good <p>Title text here</p>
        but but If I edit the richtext area again, it will display the <p>Title text here</p> but not the <h1>Title</h1> <p>text here</p>

          --
          ysanmiguel.com
          • 4172
          • 5,888 Posts
          you need to use another fieldname, something which isn't used for any field for columns with the renderChunk - renderer, otherwise it will save the rendered value to that field.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 33238
            • 388 Posts
            Quote from: Bruno17 at Jul 17, 2017, 04:31 PM
            you need to use another fieldname, something which isn't used for any field for columns with the renderChunk - renderer, otherwise it will save the rendered value to that field.

            Hello Bruno, don't get your poin, In the form tabs the field is called description and is an unique name.

            here the column code, where do I need to do the change Bruno?:

            ,{"MIGX_id":"3"
            ,"header":"Content"
            ,"dataIndex":"description"
            ,"width":"50"
            ,"sortable":"false"
            ,"show_in_grid":"1"
            ,"customrenderer":""
            ,"renderer":"this.renderChunk"
            ,"clickaction":""
            ,"selectorconfig":""
            ,"renderchunktpl":"[[+description:striptags]]"
            ,"renderoptions":""
            ,"editor":""}


            thank you! [ed. note: Ysanmiguel last edited this post 6 years, 8 months ago.]
              --
              ysanmiguel.com
            • discuss.answer
              • 4172
              • 5,888 Posts
              ,{"MIGX_id":"3"
              ,"header":"Content"
              ,"dataIndex":"render_my_description"
              ,"width":"50"
              ,"sortable":"false"
              ,"show_in_grid":"1"
              ,"customrenderer":""
              ,"renderer":"this.renderChunk"
              ,"clickaction":""
              ,"selectorconfig":""
              ,"renderchunktpl":"[[+description:striptags]]"
              ,"renderoptions":""
              ,"editor":""}
              
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 33238
                • 388 Posts
                Quote from: Bruno17 at Jul 17, 2017, 07:48 PM
                ,{"MIGX_id":"3"
                ,"header":"Content"
                ,"dataIndex":"render_my_description"
                ,"width":"50"
                ,"sortable":"false"
                ,"show_in_grid":"1"
                ,"customrenderer":""
                ,"renderer":"this.renderChunk"
                ,"clickaction":""
                ,"selectorconfig":""
                ,"renderchunktpl":"[[+description:striptags]]"
                ,"renderoptions":""
                ,"editor":""}
                

                Got it.
                didn't make sense change the "dataIndex" name, if it was the responsable to call the text from the field, but in this case the CHUNK is the responsable to do it, so it make sense now.

                Thank you very much Bruno and rgliberty for your help.

                Cheers!!!
                  --
                  ysanmiguel.com
                  • 33238
                  • 388 Posts
                  Quote from: Bruno17 at Jul 17, 2017, 07:48 PM
                  ,{"MIGX_id":"3"
                  ,"header":"Content"
                  ,"dataIndex":"render_my_description"
                  ,"width":"50"
                  ,"sortable":"false"
                  ,"show_in_grid":"1"
                  ,"customrenderer":""
                  ,"renderer":"this.renderChunk"
                  ,"clickaction":""
                  ,"selectorconfig":""
                  ,"renderchunktpl":"[[+description:striptags]]"
                  ,"renderoptions":""
                  ,"editor":""}
                  

                  Hello Bruno, my friend I'm having a little problem with this render.
                  I just realise that it works very well but only for one item, If I try to add more than one item to the MigX list it disappear, I only can add one element to the list, if I delete the [[+description:striptags]] everything works well.

                  Any idea?

                  Than you very much Bruno!
                    --
                    ysanmiguel.com