[CLOSED] responsiveconfig reliable?

  1. #1

    [CLOSED] responsiveconfig reliable?

    hello
    I wanted to use responsiveconfig but could not get MVC version working, is this reliable? what experience do you guys have with it?

    Here is an example which should change the width of grid as soon as the screen is "tall".
    Is the usage incorrect or there is bug in responsiveconfigs:

    example as GridPanel/ArrayGrid/Simple/
    @model System.Collections.IEnumerable
    
    @{
        ViewBag.Title = "Simple Array Grid - Ext.NET MVC Examples";
        Layout = "~/Views/Shared/_BaseLayout.cshtml";
    }
    
    @section headtag
    {
        <style>
            .x-grid-row-over .x-grid-cell-inner {
                font-weight : bold;
            }
        </style>
    
        <script>
            var template = '<span style="color:{0};">{1}</span>';
    
            var change = function (value) {
                return Ext.String.format(template, (value > 0) ? "green" : "red", value);
            };
    
            var pctChange = function (value) {
                return Ext.String.format(template, (value > 0) ? "green" : "red", value + "%");
            };
        </script>
    }
    
    @section example
    {
        <h1>Simple Array Grid</h1>
    
        @(Html.X().GridPanel()
                           .ResponsiveConfig(cfg =>
                               {
                            
                            var tall = new ResponsiveRule();
                            tall.Rule = "tall";
                            tall.Config.Add(Html.X().GridPanel().Width(200));
                                   
                            cfg.Add(tall);
                        })
            .Title("Array Grid")
            .Width(600)
            .Height(350)
            .Store(Html.X().Store()
                .Model(Html.X().Model()
                    .Fields(
                        new ModelField("company"),
                        new ModelField("price", ModelFieldType.Float),
                        new ModelField("change", ModelFieldType.Float),
                        new ModelField("pctChange", ModelFieldType.Float),
                        new ModelField("lastChange", ModelFieldType.Date, "M/d hh:mmtt")
                    )
                )
                .DataSource(Model)
            )
            .ColumnModel(
                Html.X().Column().Text("Company").DataIndex("company").Flex(1),
                Html.X().Column().Text("Price").DataIndex("price").Renderer(RendererFormat.UsMoney),
                Html.X().Column().Text("Change").DataIndex("change").Renderer("change"),
                Html.X().Column().Text("Change").DataIndex("pctChange").Renderer("pctChange"),
                Html.X().DateColumn().Text("Last Updated").DataIndex("lastChange")
            )
        )
    }
    Last edited by fabricio.murta; Oct 29, 2016 at 9:04 PM. Reason: no user feedback for 7+ days
  2. #2
    Hello!

    I don't remember complaints about this example not working: Miscellaneous - Responsive - Basic.

    Did you review this example while building your Responsive version?

    EDIT: I don't see you setting a wide config. Please review your sample based on the example above.
    Last edited by fabricio.murta; Sep 02, 2016 at 6:30 PM.
  3. #3
    Well tall and wide are two different configs so basically it is the same example. Run it and make your browser narrower then u see the problem. I think the problem is somehow in mvc version of this example.
  4. #4
    Hello @mirwais!

    Please be a little more specific on your problem. I got the panel resized when I make the browser window tall here.
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hello Fabricio,
    Thank you for the response. The problem is that gridpanel gets resized but the content disappear (there is no data in the grid) the model is Companies (see Companies.GetAllCompanies()) of your MVC example .../GridPanel_ArrayGrid/Simple/

    controll action:

     public ActionResult Index()
            {
                return View(Companies.GetAllCompanies());
            }
    Recap: So when the screen is 'wide' there is the content, as soon as it becomes 'tall', resize is done but the content disappears!
  6. #6
    Hello! Got it, thanks for confirming. We could reproduce this behavior and will give a good look on the code and why the contents are lost on resizing!
    Fabrício Murta
    Developer & Support Expert
  7. #7
    Hello Fabricio
    Did you have a chance to look into it?
  8. #8
    Hello @mirwais!

    Thanks for the heads up! I did a look yes, but at first I didn't find the problem. But it turned out the solution is simpler than I first thought!

    When you are specifying to the tall config item Html.X().GridPanel().Width(), it ends up providing a GridPanel with an empty column descriptor. This is somewhat expected, as it was not specified, but could very well just output nothing. But it was at some point, it seems, decided that when a GridPanel is specified, the columns configuration will also be passed, even if empty.

    So, how to not send the empty columns descriptor? Just use a parent component that does not handle columns at all and, at the same time, provides the settings you want to have changed! The base representing a grid panel then would be a container. Knowing that, you can just change your line 39 to something like this:

    tall.Config.Add(Html.X().Container().Width(200));
    After all, all you want to change there is the grid panel's container width! In case you want to change a given column's width -- or hide it, you add a corresponding .ResponsiveConfig() to the column specification in .ColumnModel() (between lines 58-64 your code).

    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  9. #9
    Hello @mirwais!

    Do you still need help with this issue? Been some days already since your last reply and our feedback, and no follow-up from you. We'll hold another week waiting for your reply. Anyway, even if we mark this thread as 'closed' (after a week from now without feedback), you will be able to post your follow-up anytime you need it.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 1
    Last Post: Dec 19, 2015, 11:14 AM
  2. responsiveConfig is problem
    By aimboss in forum 3.x Help
    Replies: 2
    Last Post: Mar 16, 2015, 2:43 AM
  3. Replies: 2
    Last Post: Mar 06, 2015, 2:21 PM

Tags for this Thread

Posting Permissions