Skip to content
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

Add multiple cellattr on column when using jqGrid #107

Closed
webdevilopers opened this issue May 20, 2014 · 2 comments
Closed

Add multiple cellattr on column when using jqGrid #107

webdevilopers opened this issue May 20, 2014 · 2 comments

Comments

@webdevilopers
Copy link
Contributor

This issue is based on issue #102.

A common jqGrid feature is using footerrow and setting footerData to add totals to the grid.

Unfortunately I could not append any javascript to the grid to add this after the grid was generated.

Same for using grouping for summary. The following demo requires setting attributes summaryType and summaryTpl on columns:

summaryType:'min', summaryTpl:'<b>Min: {0}</b>

http://trirand.com/blog/jqgrid/jqgrid.html

Of course creating your own template is a possible workaround. But mostly for only this one use case.

The jqGrid Columns view helper already has the possibility to set options:
https://github.com/ThaDafinser/ZfcDatagrid/blob/master/src/ZfcDatagrid/Renderer/JqGrid/View/Helper/Columns.php#L86-95

The getter methods get their values from \ZfcDatagrid\Column\AbstractColumn.
It would make no sense to add jqgrid typical options like summaryType there.
Extending the abstract class to define a jqgrid Column would be possible.
But using a global setOptions methods maybe is a smarter solution. And the use the view helper to set an array with "allowed" values.

Another workaround is adding options to the cellattr:
https://github.com/ThaDafinser/ZfcDatagrid/blob/master/src/ZfcDatagrid/Renderer/JqGrid/View/Helper/Columns.php#L109-115

            /**
             * Cellattr
             */
            $rendererParameters = $column->getRendererParameters('jqGrid');
            if (isset($rendererParameters['cellattr'])) {
                $options['cellattr'] = (string) $rendererParameters['cellattr'];
            }
            if (isset($rendererParameters['summaryType'])) {
                $options['summaryType'] = (string) $rendererParameters['summaryType'];
            }
            if (isset($rendererParameters['summaryTpl'])) {
                $options['summaryTpl'] = (string) $rendererParameters['summaryTpl'];
            }  

Should we add an array of possible options to set for the cellattr and add a method for setCellAttributes() and addCellAttributes instead of using the $rendererParameters?

@webdevilopers
Copy link
Contributor Author

I added an PR for this.

Should we add the validation and wait for a feature to add groupingView to the jqgrid first, @ThaDafinser ?

@ThaDafinser
Copy link
Owner

This issue was moved to zfc-datagrid/zfc-datagrid#11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants