[CLOSED] PartialViewResult broken for v2.2.0

  1. #1

    [CLOSED] PartialViewResult broken for v2.2.0

    Hi,

    I have a quick question in using PartialViewResult. I have a view which has multiple tab in it and it would be added to the tabpanel using a PartialViewResult. However, when I use the latest version of ext.net 2.2.0 from the trunk (3/18/2013). It is failing and the view only show the tab but the content did not render (ie. empty). Can you suggest way of solving it? I know you would say to submit an example. But, when I tried the same case it would work on ext.net v2.1.0.

    Thanks.
    Last edited by Daniil; Mar 26, 2013 at 4:16 AM. Reason: [CLOSED]
  2. #2
    I cannot reproduce the issue with examples from MVC Examples Explorer
    Please post your test case
  3. #3
    I search the logfile for version 2.2.0, and I found that there is a bug fix:

    [r4585] PartialViewResult generate incorrect script for Items mode

    However, when I tried this, and it doesn't seem to fix the problem. Yet, if I revert to the v2.1.1, it seems that the CustomAttributes on the TreeNode is not being serialized. (which I think has been fixed in v2.2.0).

    My question is that what has been fixed in PartialViewResult for generating correct script? Any workaround if I want to stick with v 2.1.1 if I would like the custom attributes being serialized? (I build the Tree Panel in the controller and set the root node on the client side.


    Quote Originally Posted by Vladimir View Post
    I cannot reproduce the issue with examples from MVC Examples Explorer
    Please post your test case
  4. #4
    Yet, if I revert to the v2.1.1, it seems that the CustomAttributes on the TreeNode is not being serialized.
    Online examples explorer uses Ext.Net 2.1.1 and CustomAttributes works fine
    https://examples2.ext.net/#/TreePane...nced/TreeGrid/

    My question is that what has been fixed in PartialViewResult for generating correct script?
    All code changes you can view in Show Log dialog of TortoiseSVN client for revision 4585

    Why don't you want to post a sample reproduces the PartialViewResult issue?
  5. #5
    The problem is that when you serialized the nodes to its Json string and bind it the the javascript side, the Custom Attributes are not being serialized. The online example is to build a static tree. We need to build a dynamic tree on the C# side and be able to bind the custom attributes on the client side on demand. Is there any way you can come up an example of how to do it on Ext.net v2.1.1 which is the latest stable version?

    Thanks a lot for your help.

    Quote Originally Posted by Vladimir View Post
    Online examples explorer uses Ext.Net 2.1.1 and CustomAttributes works fine
    https://examples2.ext.net/#/TreePane...nced/TreeGrid/


    All code changes you can view in Show Log dialog of TortoiseSVN client for revision 4585

    Why don't you want to post a sample reproduces the PartialViewResult issue?
  6. #6
    The problem is that when you serialized the nodes to its Json string and bind it the the javascript side, the Custom Attributes are not being serialized.
    Please demonstrate it in simple example
  7. #7
    Please investigate with the code below. We cannot get the data binded to the corresponding column. Please use the Ext.net v2.1.1 to test. We cannot move to v2.2.0 for it will break other parts of our code.

    // Controller Code
    using System;
    using System.Collections.Generic;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web.Mvc;
    using Ext.Net.MVC.Sample.Models;
    using Ext.Net.MVC.Sample.Models.Remote;
    using Ext.Net.MVC.Sample.Utilities;
    
    namespace Ext.Net.MVC.Sample.Controllers
    {
        [HandleError]
        [DirectController]
        public class OrdersSummaryController : Controller
        {
            //
            // GET: /OrdersSummary/
    
            public ActionResult Index()
            {
                return View();
            }
    
            [DirectMethod]
            public DirectResult ReBuildOrderSummaryTree()
            {            
                NodeCollection nodes = BuildTree2(null);
                return this.Direct(nodes.ToJson());
            }
    
            
            private NodeCollection BuildTree2(NodeCollection nodes)
            {
                if (nodes == null)
                {
                    nodes = new NodeCollection();
                }
    
                var root = new Node();
                root.Text = "Root";
                root.NodeID = "Root";
                root.Expanded = true;
                nodes.Add(root);
    
                var node = new Node
                               {
                                   NodeID = "USTP",
                                   Leaf = false,
                                   Icon = Icon.Folder,
                                   /*CustomAttributes =
                                       {
                                           new ConfigItem("Region", "USTP"),
                                           new ConfigItem("FlowType", "ALGO"),
                                           new ConfigItem("Moniker", "WA"),
                                           new ConfigItem("BusUnit", "USTP"),
                                           new ConfigItem("Shares", "999"),
                                           new ConfigItem("OrdersCount", "1000")
                                           
                                       },*/
                                   AttributesObject = new { region = "USTP", flowType = "ALGO", 
                                   moniker = "WA", busUnit = "USTP", shares = 999, ordersCount = 1000},
                                       Expandable = false, EmptyChildren = true
                               };
    
                root.Children.Add(node);
               
                return nodes;
            }
        }
    }



    
    @model dynamic
    
    @Html.X().ResourceManager()
    
    @{
        ViewBag.Title = "Orders Summary";
        Layout = null;
        BuilderFactory<dynamic> X = Html.X();
    
        <script>
            var OnSelectionChange = function(selModel, node) {
    
            };
    
            var refreshTree = function () {
                Ext.getBody().mask('Loading Order Summary...', 'x-mask-loading');
                App.direct.ReBuildOrderSummaryTree({
                    success: function (result) {
                        var nodes = eval(result);
                        if (nodes.length > 0) {
                            App.TreePanel1.setRootNode(nodes[0]);
                        } else {
                            App.TreePanel1.getRootNode().removeAll();
                        }
                        Ext.net.Mask.hide();
                    },
                    failure: function (result) { Ext.net.Mask.hide(); }
                });
            }
            
            
        </script>
    
        <style>
            .x-grid-custom .x-grid-row TD { font: 12px/16px "segoe ui", arial, sans-serif; }
    
            .x-grid-custom .x-column-header {
                background: #718CA1 url(../../header_sprite.png) repeat scroll 0 bottom;
                border-left-color: #6085A5;
                border-right-color: #728BA1;
                font: 12px/16px "segoe ui", arial, sans-serif;
                height: 22px;
            }
    
            .x-grid-custom .x-column-header-over { background: #65a3f1 url(../../header_sprite_over.png) repeat 0 bottom !important; }
    
            .x-grid-custom .x-column-header div { color: white; }
    
            .x-grid-custom .company-link { color: #0E3D4F; }
    
            .x-grid-custom .x-column-header-trigger { background: #718CA1 url(../../grid3-hd-btn.png) no-repeat left center; }
    
            .x-grid-custom .x-grid-row-alt .x-grid-cell { background-color: #DAE2E8; }
    
            .x-grid-custom .x-grid-row-over .x-grid-cell {
                background: url(../../row-over.png);
                border-color: #728BA1;
            }
    
            .x-grid-custom .x-grid-row-selected .x-grid-cell {
                background: url(../../row-selected.png) repeat-x scroll 0 0 #7BBBCF;
                border-color: #728BA1;
                border-style: solid;
            }
    
            .x-grid-custom .x-grid-row-selected TD,
            .x-grid-custom .x-grid-row-selected TD .company-link { color: #fff; }
    
            .x-grid-custom .x-toolbar .x-toolbar-text { color: #fff !important; }
    
            .x-grid-custom .x-toolbar { background: url(../../toolbar-bg.png) repeat-x 0 0 !important; }
    
            .x-grid-custom .x-tbar-loading { background-image: url(../../refresh.gif) !important; }
    
            .x-grid-custom .x-tbar-page-first { background-image: url(../../page-first.gif) !important; }
    
            .x-grid-custom .x-tbar-page-last { background-image: url(../../page-last.gif) !important; }
    
            .x-grid-custom .x-tbar-page-next { background-image: url(../../page-next.gif) !important; }
    
            .x-grid-custom .x-tbar-page-prev { background-image: url(../../page-prev.gif) !important; }
    
            .x-grid-custom .x-paging-info { color: #fff; }
        </style>
    }
    
    <!DOCTYPE html>
    
    <html>
        <head>
            <title>title</title>
        </head>
        <body>
            @(X.TreePanel().Title("Orders Summary").ID("TreePanel1").NoLeafIcon(false)
               .Animate(true).Cls("x-grid-custom")
    //           .Width(500)
               .Height(900)
               .Collapsible(true)
               .UseArrows(true)
               .RootVisible(false)
               .MultiSelect(true)
               .SingleExpand(false)
               .FolderSort(true)
               .Fields(
                   X.ModelField().Name("busUnit"),
                   X.ModelField().Name("shares").Type(ModelFieldType.Int),
                   X.ModelField().Name("ordersCount").Type(ModelFieldType.Int),
                   X.ModelField().Name("notional").Type(ModelFieldType.Float)
               )
               .ColumnModel(
                   X.TreeColumn()
                       .Text("Business Unit")
                       .Flex(1)
                       .DataIndex("busUnit"),
                   X.NumberColumn()
                       .Text("Shares")
                       .Flex(1)
                       .DataIndex("shares")
                       .Align(Alignment.Right)
                       .Format("0,000."),
                       //.Align(Alignment.Center),
                   X.NumberColumn()
                       .Text("Orders Count")
                       .Flex(1)
                       .DataIndex("ordersCount")
                       .Align(Alignment.Right)
                       .Format("0,000.")
                      
               )
               .SelectionModel(Html.X().TreeSelectionModel()
                                   .Mode(SelectionMode.Single)
                                   .Listeners(ls => ls.SelectionChange.Fn = "OnSelectionChange")
               )
               .Tools(Html.X().Tool().Type(ToolType.Refresh)
                          .Handler("refreshTree();")
                          .ToolTips(tts => tts.Add(Html.X().ToolTip().ID("ToolTip1").Html("Refresh"))
                          )
               )
               .Root(
                   X.Node().Text("Business Units")
                       .EmptyChildren(true)
               )
                  )
        </body>
    </html>
  8. #8
    Your sample works fine for me, i see data in columns
    Tested with versions from
    http://svn.ext.net/premium/branches/2 <- source code for Ext.Net 2.1.1
    http://svn.ext.net/premium/branches/2.1
    http://svn.ext.net/premium/trunk

Similar Threads

  1. [CLOSED] PartialViewResult
    By Z in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Oct 23, 2012, 5:01 AM
  2. MVC PartialViewResult
    By geraldf in forum 2.x Help
    Replies: 6
    Last Post: Sep 05, 2012, 10:17 PM
  3. [CLOSED] [MVC] Set Active Tab with PartialViewResult
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 23, 2012, 6:18 PM
  4. MVC + PartialViewResult And Model
    By barroei in forum 1.x Help
    Replies: 3
    Last Post: Feb 15, 2011, 3:30 PM
  5. [CLOSED] PartialViewResult and Model
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 26
    Last Post: Feb 14, 2011, 9:23 PM

Tags for this Thread

Posting Permissions