How can I get defaultGridPageSize and gridPageSizes in my plugin view.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
How can I get defaultGridPageSize and gridPageSizes in my plugin view.

I am trying to enable paging on my Grid but cant seem to get this code  

  var defaultGridPageSize = EngineContext.Current.Resolve<Nop.Core.Domain.Common.AdminAreaSettings>().DefaultGridPageSize;
    var gridPageSizes = EngineContext.Current.Resolve<Nop.Core.Domain.Common.AdminAreaSettings>().GridPageSizes;


to work in my view.
7 years ago
(what error are you getting?)

As example, Look at  nopCommerce380\Plugins\Nop.Plugin.Shipping.ByWeight\Views\ShippingByWeight\Configure.cshtml
You're either missing the { ...}, or the usings

@{
    Layout = "";

    var defaultGridPageSize = EngineContext.Current.Resolve<Nop.Core.Domain.Common.AdminAreaSettings>().DefaultGridPageSize;
    var gridPageSizes = EngineContext.Current.Resolve<Nop.Core.Domain.Common.AdminAreaSettings>().GridPageSizes;
}
...
@using Nop.Web.Framework;
@using Nop.Core.Infrastructure;
7 years ago
@New York

Thanks I fixed it, I just added them manually in my Kendo grid script like below

<script>
...
pageSize: 5,
...
},
pageable: {
refresh: true,
pageSizes: [5, 10]
},
...
</script>


I was getting this error
The name 'EngineContext' does not exist in the current context.
7 years ago
That error means you need the usings
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.