thisfx-backstage / yii2-ajaxcrud-bs4
Gii CRUD template for Single Page Ajax Administration for yii2
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 14
Open Issues: 0
Type:yii2-extension
Requires
- fortawesome/font-awesome: ^5.15
- kartik-v/yii2-editable: ^1.7.3
- kartik-v/yii2-grid: ^3.0.4
- kartik-v/yii2-mpdf: ^1.0.0
- yiisoft/yii2: *
- yiisoft/yii2-bootstrap4: *
- yiisoft/yii2-gii: *
This package is auto-updated.
Last update: 2024-12-12 11:11:05 UTC
README
Original work by johitvn.
Forked from biladina.
But we need to work with Bootstrap 4, so we create this repository. If johitvn update his repo, we will delete this repository.
Gii CRUD template for Single Page Ajax Administration for yii2
Features
- Create, read, update, delete in onpage with Ajax
- Bulk delete suport
- Pjax widget suport
- Export function(pdf,html,text,csv,excel,json)
- Support Boostrap 4
- Added translations, available right now only English and Indonesia
- Reload multiple Pjax
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require thisfx-backstage/yii2-ajaxcrud-bs4
or add
"thisfx-backstage/yii2-ajaxcrud-bs4"
to the require section of your composer.json
file.
Usage
For first you must enable Gii module Read more about Gii code generation tool
Because this extension used kartik-v/yii2-grid extensions so we must config gridview module before
Let 's add into modules config in your main config file
'modules' => [ 'gridview' => [ 'class' => '\kartik\grid\Module' ] ]
You can then access Gii through the following URL:
http://localhost/path/to/index.php?r=gii
and you can see Ajax CRUD Generator
Translate
Default translation is english, you can pull request new translation and you can change via config. Open your config main.php
, add new translation to components..
Available Translation :
- English
- Indonesia
'language' => 'id-ID', 'components' => [ 'i18n' => [ 'translations' => [ 'yii2-ajaxcrud' => [ 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@yii2ajaxcrud/ajaxcrud/messages', 'sourceLanguage' => 'id', ], ] ] ]
Reload Multiple Pjax
If you need to reload multiple GridView Pjax via Ajax respond from controller, you can add another Pjax ID separated by comma.
return [ 'forceReload'=>'#crud-pjax1,#crud-pjax2', // you can add more Pjax ID that you want to reload via ajax respond. 'title'=> Yii::t('yii2-ajaxcrud', 'Create New')." Content", 'content'=>'<span class="text-success">'.Yii::t('yii2-ajaxcrud', 'Create').' Content '.Yii::t('yii2-ajaxcrud', 'Success').'</span>', 'footer'=> Html::button(Yii::t('yii2-ajaxcrud', 'Close'), ['class'=>'btn btn-default pull-left','data-dismiss'=>"modal"]). Html::a(Yii::t('yii2-ajaxcrud', 'Create More'), ['create'],['class'=>'btn btn-primary','role'=>'modal-remote']) ];