Grid not updating for certain values

Dec 4, 2014 at 1:31 PM
Hi There,

I think this is a very good product and I was able to get up to speed quite quickly on this which is good when I'm new to MVC and web techs!

So I've got my grid working pretty much as I'd expect, its bound to two combo-box's on my page one which lists several portfolios and the other that lists available dates for that portfolios valuation. Aside from the call the grid makes there is a simultaneous ajax query that fires off the calculation of a partial view which shows some summary data that included in the grid.

This is great except sometimes the grid doesn't update for certain months, curiously the same particular months for specific portfolios. The data is been sent back from my controller correctly and I can see it when I monitor the network traffic.

Would the grid use caching? I've tried clearing my browser cache and include time stamps in my grid data but the grid still doesnt update.

Any ideas as to whats going wrong? For instance one portfolio updates correctly for Nov 2013 but it fails for Dec 2013 (it still includes the values for Nov 2013) if I select Dec 13 first then the grid remains blank. In both examples I can see that the correct data is been returned to the browser.
Coordinator
Dec 4, 2014 at 2:01 PM
the grid does just one request, and in order to do aggregates/summaries you don't need additional requests,
have a look at this demo: http://demo.aspnetawesome.com/GridDemo/Grouping

also keep the console open, to see if there's any errors (F12 or Ctrl+Shift+I)
Dec 4, 2014 at 2:22 PM
Yeah there are no errors in the console and as I say the network monitor shows the data returned correctly to the browser

The partial view isn't just aggregate data, it also includes data that doesn't really fit the list type data the grid contains.

The ajax query thats called at the same time as the grid sends its request to the controller is:
  $(document).ready(function() {
        $('#availablemonths').on('change', function () {
       
            var PID = $('#portfolio').val();
            var MONTH = $('#availablemonths').val();

            $.ajax({
                type: "GET",
                dataType: 'html',
                url: '@Url.Action("GetItems2", "PortfolioValuation")/',
                data: {
                    PortfolioID: PID,
                    PortfolioValueDate: MONTH
                },
                success: function (data) {
                    $('#fundvalsummary').html(data)
                },
                error: function (xhr, ajaxOptions, thrownError) { alert(thrownError); }
                //dataType: 'html',

            });

            });

    })
And the grid:
 @Html.Awe().Grid("FundGrid").Columns(
                          new Column { Name = "FundID", ClientFormat = "<div class='detailbtn'><i class='ui-icon ui-icon-triangle-1-e awe-il'></i></div>", Width = 20, Header = "" },
                          new Column { Name = "FundName", PercentWidth = 40, Header = "Fund Name", Sort = Sort.Asc },
                          new Column { Name = "OpeningMV", PercentWidth = 25, Header = "Opening MV", ClientFormatFunc = "formatOpen" },
                          new Column { Name = "CurrentMV", PercentWidth = 25, Header = "Closing MV", ClientFormatFunc = "formatClose" },
                          new Column { Name = "Ret", PercentWidth = 10, Header = "Return", ClientFormatFunc = "formatPercent" }
                            ).Url(Url.Action("GetItems")).SingleColumnSort(true).PageSize(50).Groupable(false
                            ).Parent("portfolio", "PortfolioID").Parent("availablemonths", "PortfolioValueDate"
                                                       ).Nests(new Nest { ButtonClass = "detailbtn", Url = Url.Action("GetClasses", "PortfolioValuation"), LoadOnce = true })
Coordinator
Dec 4, 2014 at 2:44 PM
Edited Dec 4, 2014 at 2:49 PM
you can send additional data along the grid result
something like this:
var gridModel = new GridModelBuilder<Lunch>(...).Build();

gridModel.Tag =
    new
        {
            Val1 = this.RenderView(...
        };

return Json(gridModel);
and use it on the client like this:
    $('#Grid1').on('aweload', function (event, res) {
            alert(res.Tag.Val1);
        });
you could also try setting gridModel.Map and instead of Date properties return string (call ToString(), see if that changes anything)

btw instead PercentWidth you could just use Width its proportional anyway

aside from that I can't really tell what could be wrong, unless you create a mini project using the trial version (no DB) and post here a download link
Coordinator
Dec 7, 2014 at 4:05 PM