ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Dynamic Grid with client filter
Title:
B
I
{code}
?
I see your https://demo.aspnetawesome.com/GridFilterRowClientData sample, Is that's what i need, but I have a dynamic grid and the columns are creatye with source... es: columns.Add(new Column { Header = column.ColumnName, ClientFormatFunc = "getVal(" + i + ")" }); Is it possible to add search function in this way ?
Save Changes
Cancel
Meccanica Rossi
asked at 01 Sep 2023
version 7.7. released you can try this updated demo now: https://demo.aspnetawesome.com/GridArrayDataSource
at 20 Sep 2023
Omu
In your example I didn't understand well why the header must be defined both in the controller and in the grid cfg view
at 21 Sep 2023
Meccanica Rossi
in the controller we're getting the data, and in our example the first row is the header labels (text that we'll put on the column header), similar to csv, in your case it might not be this way; how do you find out the column header texts ? or do you just need to write column1, column2, etc.
at 21 Sep 2023
Omu
I put the name of the dataset column
at 21 Sep 2023
Meccanica Rossi
ok, you just need to pass that info to the cfg view in some form in order set the columns for the grid, in our case we passed a `string[]`, that's why cfg view has `@model string[]`
at 21 Sep 2023
Omu
I tried, but I have difficulty regenerating and binding fields, can I send you an example?
at 21 Sep 2023
Meccanica Rossi
what do you mean by regenerating ? in our example grid columns are bound to the array[][] column index (an int), and we are defining our custom orderBy `gmb.OrderByFunc = ArrayRowOrderBy;` (otherwise sorting won't work) you'll need something similar, or if you transform your datasource to an `array[][]` you could simply copy our code
at 21 Sep 2023
Omu
I found the problem :) this function getVal(i) { return function (model) { if (model.values) { return model.values[i]; } }; } instead function getVal(i) { return function (model) { if (model.Values) { return model.Values[i]; } }; }
at 22 Sep 2023
Meccanica Rossi
in the future you can do console.log(model); to verify json gets automatically transformed to camelCase https://github.com/aspnet/Mvc/issues/4283 we write about this in the readme.txt for the demo we have it turned off in Program.cs
at 22 Sep 2023
Omu
yes, but i just upgrading an old project, and was hard found the bug (my bug)
at 22 Sep 2023
Meccanica Rossi
I recreated the grid on your "Min Setup Demo" example, as I had anticipated the aim would be: Load a generic SQL query present in files inside the App_Data folder, execute it and load the result into a grid. I managed to get everything without errors, but the following problems occur: 1) The query data is displayed correctly, but the number of columns is not updated 2) In the footer line every time I change the file to read, the footer entries are added (pagesize, n.items and column selector) Can I send my example that I prepared? PS: it is complete and relies on a SQLITE db Thank you
at 25 Sep 2023
Meccanica Rossi
upload it somewhere and post the link here
at 25 Sep 2023
Omu
https://zerogi.monteverso.com/MinAweCore.zip "Dynamic Grid" on menu then "select a script"
at 25 Sep 2023
Meccanica Rossi
the code looks like a mix of many things, previous version of array data source demo and current one, you are using `SendColumns` and also creating `new Column` in the controller, in the new demo we're not doing that, there's multiple `GridCfg.cshtml`, looks like you're want to change the grid cfg each time you change the value of the script dropdown on top, we'll try to do this in our demo and let you know.
at 25 Sep 2023
Omu
Yes, I used SendColumns to try to "reset" the columns and then create new ones, but I couldn't.
at 26 Sep 2023
Meccanica Rossi
Please follow this demo: https://demo.aspnetawesome.com/GridArrayDataSource#Change-Grid-from-dropdown You'll need to redownload from your profile the new version 7.7.2 Please don't add SendColumns, just follow the new demo code.
at 26 Sep 2023
Omu
Wow !! a new version for my sample . Thank you very much, run all correctly
at 27 Sep 2023
Meccanica Rossi
Answers
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