ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Set initial value for the Grid column filter when using FilterRow()
Title:
B
I
{code}
?
I'm trying to set an initial value for the grid column filter when using FilterRow, here's the code for my attempts: new Column { Bind = "??", Header = "??" } .FltDropdownList(new DropdownListOpt { Name = "??", Url = Url.Action("GetTime001", "POSHR_COUNT"), Value="??", ClearBtn=false, }), http://shuomaotec.com/AweMvc577/FilterRow_001.png http://shuomaotec.com/AweMvc577/FilterRow_002.png
Save Changes
Cancel
RayBen
asked at 05 Feb 2024
Answers
B
I
{code}
?
If you want to set initial value for the column filter you could do something similar like in the following demo where we save the filter values to session storage: https://demo.aspnetawesome.com/GridSaveFilters#Grid-filter-row-save-filters-to-session-storage So a simpler version where all you want is to set the initial value could look like this: @(Html.Awe().Grid("GridFrow2") .Mod(o => o.Main().FilterRow().Custom("setFilterInitVal")) .Columns( new Column { Bind = "Person" } .FltString(), ... <script> function setFilterInitVal(o) { var g = o.v; g.on('awefinit', function () { o.fltopt.model = { Person: 'hi' }; o.fltopt.order = ['Person']; }); } </script>
Save Changes
Cancel
Omu
answered at 05 Feb 2024
It can work thanks!
at 05 Feb 2024
RayBen
o.fltopt.order = ['Person']; Does it have any function? Could you please explain it?
at 05 Feb 2024
RayBen
yes, the order of the filters, try using our demo: https://demo.aspnetawesome.com/GridFilterRowServerSideData pick a value in the Food column filter, after in Country, reset the grid and try the other way around.
at 05 Feb 2024
Omu
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK