Yii Framework Forum: Yii2 Grid - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Yii2 Grid GridView enhancements and utilities for Yii Framework 2.0. Rate Topic: ***** 1 Votes

#1 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 20 March 2014 - 03:09 PM

This is the forum for the yii2-grid extension.

Yii2 GridView on steroids. Various modifications and enhancements to one of the most used widgets by Yii developers. The widget contains new additional Grid Columns with enhanced settings for Yii Framework 2.0. The widget also incorporates various Bootstrap 3.x styling options. Refer detailed documentation and/or a complete demo.

The demo page is in process and will be updated soon.
0

#2 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 21 March 2014 - 09:11 AM

View PostKartik V, on 20 March 2014 - 03:09 PM, said:

The demo page is in process and will be updated soon.

FYI - the DEMO PAGE is online for this extension. The demo doubles up as a GridView configurator as well. You can configure various widget options dynamically and see the impact.
0

#3 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 26 March 2014 - 03:54 PM

Upgrade to v1.1.0. Various new enhancements to the templates, including GRID EXPORT to HTML, CSV, and EXCEL FORMATS. It uses a newly developed JQuery plugin to export the DISPLAYED grid as HTML/CSV. The excel format is being worked upon.

Refer the UPDATED documentation and demos.
0

#4 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 27 March 2014 - 08:51 AM

FYI... the `yii2-grid` extension has been enhanced:

1. to work with all browsers in a more secure and reliable manner
2. to support export of the displayed grid and download as HTML, TEXT, CSV, and EXCEL formats
3. configurable file names for export
4. configurable worksheet name for excel
5. configurable column and row delimiters for export as TEXT or CSV
6. i18n/translation enabled
7. and the extension is a module now which has potential to add on more features later.

and more other features... Refer the updated documentation and demo.
0

#5 User is offline   Erik_r 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 22-January 14
  • Location:Zurich

Posted 06 April 2014 - 03:16 PM

Hello Kartik

First thank you for your distributions and good ideas. I'm wondering why your grid, helpers and the active form widget aren't used in the core of Yii2.

Concerning the grid widget I have a question and an idea for further features.

1) Why does your PJAX work with filters (in your demo) while the original grid doesn't work in my test app? Could you publish the source code of your demo page?

2) Filtering is a good possibility but it can't be stored. My idea is to have an enrichment which could be added to your grid. This extension should a selection box and a button. If you push the button you get a dialog in which you can add a filter name and you can reorder the columns including hiding. If you store this name then the current filter settings, sort order, column order will be stored under the grid name, filter name and user in the database. One name should be marked as default if the grid is rendered first time.

The administrator should store such settings under a default user and filter name in addition which are available for all users. These entries per grid can't be deleted by the user.

Such a class would help to have configured grids in an application per example records with a status "active". If user want to see historical data he can change the filter settings easily by selecting another filter name.
0

#6 User is offline   daab 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 09-June 09

Posted 08 April 2014 - 09:52 AM

Hi Kartik

You might show the complete configuration in the example of the DataGrid?

regards

Domingo
0

#7 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 11 April 2014 - 06:19 AM

View Postdaab, on 08 April 2014 - 09:52 AM, said:

You might show the complete configuration in the example of the DataGrid?

On the demo page, click on the Grid Columns Setup button on the top and you will get the configuration code of all the grid columns used for the demo. That is the major part.

The other settings for the table settings, panel etc. are properties which you can directly relate to from the documentation.
0

#8 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 12 April 2014 - 01:17 PM

View PostErik_r, on 06 April 2014 - 03:16 PM, said:

First thank you for your distributions and good ideas. I'm wondering why your grid, helpers and the active form widget aren't used in the core of Yii2.

You are welcome! Note: Most of my extensions use the inherent/core Yii 2.0 functionality and extensibility - probably that's the reason why some of these extensions are useful. Also, I just have my interpretation and ideas on some of these stuff and shared them with community - not sure everyone may need it the way I thought of. Glad, that its useful for you.

View PostErik_r, on 06 April 2014 - 03:16 PM, said:

1) Why does your PJAX work with filters (in your demo) while the original grid doesn't work in my test app? Could you publish the source code of your demo page?

Nothing special in the demo app. You would need to enclose the GridView widget between Pjax::begin(); and Pjax::end();. If you already have done that, you may want to look if your vendor folder is updated for latest yii release (run a composer update)

View PostErik_r, on 06 April 2014 - 03:16 PM, said:

2) Filtering is a good possibility but it can't be stored. My idea is to have an enrichment which could be added to your grid. This extension should a selection box and a button. If you push the button you get a dialog in which you can add a filter name and you can reorder the columns including hiding. If you store this name then the current filter settings, sort order, column order will be stored under the grid name, filter name and user in the database. One name should be marked as default if the grid is rendered first time.

Thanks for the suggestion. The only challenge with such a requirement, is it requires a database or some storage mechanism to save such configs. At this stage, most extensions I have do not have any specific database requirements (as that may change from case to case). But still, if this is needed by many, I will build this once I have time. Maybe you can record an issue/enhancement request on github and I would consider it when I have time.
0

#9 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 18 April 2014 - 12:51 AM

The module has been upgraded to v1.3 (refer change log).

With translations contributed by couple of folks, have included a LANGUAGE selector to the grid demo. So you can check the translations as well.
0

#10 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 16 May 2014 - 10:45 AM

The grid ActionColumn has been enhanced to include the option of rendering the action buttons as a dropdown menu. Check the updated demo.
0

#11 User is offline   habecht 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 11-May 14

Posted 18 May 2014 - 08:18 AM

Hi Kartik,
how does your great GridView extension work with filter type GridView::FILTER_DATE? I have stored unix timestamps in my application database and I am not sure, what kind of data the 'filter' attribute expects.

Thank you very much in advance.
0

#12 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 18 May 2014 - 09:28 AM

View Posthabecht, on 18 May 2014 - 08:18 AM, said:

Hi Kartik,
how does your great GridView extension work with filter type GridView::FILTER_DATE? I have stored unix timestamps in my application database and I am not sure, what kind of data the 'filter' attribute expects.

Thank you very much in advance.

The GridView::FILTER_DATE will render the kartik\widgets\DatePicker widget. Refer docs for DatePicker widget on options supported.

You need to pass the format options for displaying the date in DatePicker. Use the filterWidgetOptions property:
'filterWidgetOptions' => [
   'pluginOptions'=>['format' => 'dd-mm-yyyy']
]

Also, you need to convert back the date time to a user friendly format for display in your grid column. So your complete column looks like this
[
    'attribute'=>'publish_date',
    'value'=>function ($model, $index, $widget) {
        return date("d-M-Y", $model->publish_date);
    },
    'filterType'=>GridView::FILTER_DATE,
    'filterWidgetOptions' => [
        'pluginOptions'=>['format' => 'dd-mm-yyyy']
    ]
],

Then in your model->search function you need to convert this date format back to unix timestamp before filter query is executed. Something like
$timestamp = date_create_from_format("d-M-Y", $model->publish_date);
$model->publish_date = date("U", $timestamp); 

0

#13 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 05 July 2014 - 03:06 AM

The latest version of the module is v1.5.0 released on 04-Jul-2014. With this release, the GridView now offers you to add customized header and footer rows above/below the default header.

Refer updated documentation and updated demo.
0

#14 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 10 July 2014 - 12:57 PM

The latest version of the module is v1.6.0 released on 10-Jul-2014. Refer the CHANGE LOG for details. Also refer updated documentation and demo.
0

#15 User is offline   Practice_OPL 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 17-July 14

Posted 17 July 2014 - 08:35 AM

I think that your GridView should be default Yii2 GridView, but it could be better :rolleyes:
I don't know if there is a way to group columns in your GridView, so I've added it to Yii2 by myself, but my code isn't nice and I'm sure you can make it better.
I know that there is some 'group columns' that generate HTML tag 'colgroup' [in 2amigos editable grid extension as I remember], but with this I can only edit CSS of 'group'.

I think that many users need real 'group columns' - possiblity to put few model attributes in one column.

Example: I got model 'Users' with 4 attributes 'name, surname, email, phone' and I want display it in 3 (not 4!) columns 'Name Surname, E-mail, Phone'.
('column group' configurable header [ex. 'Name' in place of 'Name Surname'] could be nice, but then 'order by' won't work proper [ex. sort by Surname when I click on Surname]))

My 'GroupColumnsGridView' class:
link: paste.ots.me/560725/text
Example view code [just idea, not tested code]:
(example code merge columns 'name' and 'surname' [headers,filters and values] into one column 'Name, Surname' - columns should export in this format, column values should be editable by EditableColumn [2amigos extension], columns should be filterable and sortable)
link: paste.ots.me/560724/text

and now worst part of my code.. I had to edit Yii2 'Column' class to make it store 'group' attribute and return array('content' => '..', 'options' => '..') in place of <td option="optionvalue" ...>content</td> for grouped columns.
My modified Column class:
link: paste.ots.me/560726/text

Attached File  GRIDCOLUMNS.jpg (96.64K)
Number of downloads: 63
0

#16 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 17 July 2014 - 08:53 AM

Practice_OPL thanks for your feedback. Could you create an enhancement on Github with your proposed code or maybe a PR? I could not see all of your pasted/linked code/images due to some reason.
0

#17 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 17 July 2014 - 09:06 AM

I just did get to see your code by pasting the links in a new window. It may still be great if you can help create a PR for better tracking.
0

#18 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 31 July 2014 - 02:10 PM

New Editable Column has been added with the latest release v1.8.0. Refer documentation and demo for details.
0

#19 User is offline   ThePr0f3550r 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 27-September 12

Posted 20 August 2014 - 03:56 PM

Kartik-V.. Your extension always awesome.. it many help me to develop app..

I and maybe many people that using editable column maybe have trouble when using PJAX too..

This error is EditableColumn not work when Gridview refresh/reload with PJAX.. and I see in Your demo
http://demos.krajee.com/grid-demo
You use PJAX too??

Okey lets follow my trial..

1) Open http://demos.krajee.com/grid-demo
2) Klik editable in column name and we get editable form popup.. (okey its work)
3) Klik Reset Grid button in right top left Gridview
4) Klik again editable in column name.. eng ing eng.. Its not work..
0

#20 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 651
  • Joined: 29-August 12

Posted 21 August 2014 - 04:51 PM

View PostThePr0f3550r, on 20 August 2014 - 03:56 PM, said:

Kartik-V.. Your extension always awesome.. it many help me to develop app..


Extension upgraded to release v1.9.0 with various new Pjax enhancements. Refer documentation and demos for the various settings. Extension now includes Pjax support by default - you do not need to enclose it within Pjax widget.
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users