-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Altering and hiding fields without updating the complete fields configuration #99
Comments
Thank you very much for valuable feedback. |
If I found the time to dig deeper into the inner workings of jsGrid, I could fork it and add this feature myself, but unfortunately I guess I won't have the time for that any time soon. |
Added method |
Hello, Please,... сan you say, how we can use this method? $("#jsGrid") .jsGrid({
inserting : false,
filtering: true,
editing: true,
visible:true,
fields: [
...
{ name: "EmailContent", visible: false, type: "text", width: 50,height: "auto", title:'Email'},
...
],
}); But it dosn't work! Help |
Are you sure you downloaded latest version? Since it's not released yet, you have to build script yourself, because dist dir contains last released scripts. |
Yes, I am sure that downloaded the latest version. We downloaded the new 2 folders: src & test. |
Am I right, that you downloaded latest sources and reference files from |
So, in fact this feature is doesn't work. We were unable to use it. It actually not hide, but destroy element from DOM. If we use it, we can't get access to data of hidden field. |
@SkyStalker, the original case was meant to provide an API to change field config, and this is implemented. |
@tabalinas the field value should be hidden but preserved and be able to be sent over to the server using insertItem function. |
I am transitioning from Datatables (http://datatables.net) to js-grid because Datatables is bloated and dusty and js-grid made a very good first impression on me.
However, I am missing convenient ways of altering or hiding fields that I temporarily don't want to show. Updating the complete 'fields' option via
$('#my_grid').jsGrid('option', 'fields', []);
seems too cumbersome, because in addition to the changed field, I also always need to include the static fields that I never intend to change in the configuration array.A utility method like
jsGrid.alterField(column_name, new_settings)
orjsGrid.alterField(column_name, key, value)
would be really helpful for reducing overhead.Hiding a column via CSS is not ideal either, because that messes up the widths of the other columns that have been calculated by js-grid. Datatables has a "visible" property for each field. This way, you can preconfigure all columns, even the ones that you don't want to show immediately. When the time has come, you can simply change the "visible" property to true and the preconfigured column will show up. In combination with the abovementioned
alterField()
method you could easily show and hide columns with the benefit of js-grid recalculating the widths of the other columns, so that everything looks nice all the time.A call to
$('#my_grid').jsGrid('alterField', 'my_hidden_column', 'visible', true);
would make my hidden column show up and re-render the table, so that all widths are recalculated nicely.The text was updated successfully, but these errors were encountered: