Giter Club home page Giter Club logo

yii2-ajaxcrud's Introduction

yii2-ajaxcrud

Latest Stable Version License Total Downloads

Gii CRUD template for Single Page Ajax Administration for yii2

yii2 ajaxcrud extension screenshot

Features

  • Create, read, update, delete in onpage with Ajax
  • Bulk delete suport
  • Pjax widget suport
  • Export function(pdf,html,text,csv, excel,json)

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist johnitvn/yii2-ajaxcrud "@dev"

or add

"johnitvn/yii2-ajaxcrud": "^2.1"

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::class,
        'bsVersion' => '4.x', // or '3.x'
        // 'downloadAction' => 'gridview/export/download',
        // 'i18n' => [],
        // 'exportEncryptSalt' => 'tG85vd1',
    ]       
]

Note: Font Awesome icons not required! See Bootstrap icons!

You can then access Gii through the following URL:

http://localhost/path/to/index.php?r=gii

and you can see Ajax CRUD Generator

Lets contibute to keep it updated and make it useful for all friends.

yii2-ajaxcrud's People

Contributors

abumaryam avatar athikurrakhman avatar drsdre avatar er-kalpesh avatar hoaaah avatar johnitvn avatar padlian avatar qsebastianp avatar slightlydiff avatar waffle-iron avatar wintersilence avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-ajaxcrud's Issues

Delete All with no selection

the close button isn't working when no item selected.
I replaced the following code in ajaxcrud.js as quick solution
modal.addFooterButton("Close", 'btn btn-default', function (button, event) {
this.hide();
});
with
modal.setFooter('Close');

or we can edit addFooterButton function in ModalRemote.js to accept more option like (dismiss="modal").
Thanks you.

Extension for ajaxcrud base controller

Hi John,

I've wanted to let you know that I started a new extension (https://github.com/drsdre/yii2-radtools) which adds base controller classes for your excellent ajax crud functionality. The goal is to quickly setup CRUD structures and minimize code redundancy (and ongoing management). Additionally it adds functionality like hierarchical links (i.e. persistent prefiltered grids), configurable auto-breadcrumbs, subgrids, editable field handling and persistent grid filtering, sorting and page selection.

The extension is being actively developed. The most prominent missing features is a GII generator which is being worked on.

If you see value in integrating and combining the power of the two extensions together, let me know.

Andre

Instalation Issue

composer require --prefer-dist johnitvn/yii2-ajaxcrud "*"

The "yiisoft/yii2-composer" plugin requires composer-plugin-api 1.0.0, this WILL break in the future and it should be fixed ASAP (require ^1.0 for example)../composer.json has been updated
The "yiisoft/yii2-composer" plugin requires composer-plugin-api 1.0.0, this WILL break in the future and it should be fixed ASAP (require ^1.0 for example).
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- johnitvn/yii2-ajaxcrud 2.0.7 requires kartik-v/yii2-mpdf v1.0.0 -> no matching package found.
- johnitvn/yii2-ajaxcrud 2.0.6 requires kartik-v/yii2-mpdf v1.0.0 -> no matching package found.
- johnitvn/yii2-ajaxcrud 2.0.5 requires kartik-v/yii2-mpdf v1.0.0 -> no matching package found.
- johnitvn/yii2-ajaxcrud 2.0.4 requires kartik-v/yii2-mpdf v1.0.0 -> no matching package found.
- johnitvn/yii2-ajaxcrud 2.0.3 requires kartik-v/yii2-mpdf v1.0.0 -> no matching package found.
- johnitvn/yii2-ajaxcrud 2.0.2 requires kartik-v/yii2-mpdf v1.0.0 -> no matching package found.
- johnitvn/yii2-ajaxcrud 2.0.1 requires johnitvn/yii2-ajaxcrud-assets 2.0.* -> no matching package found.
- johnitvn/yii2-ajaxcrud 2.0.0 requires johnitvn/yii2-ajaxcrud-assets 1.0.* -> no matching package found.
- johnitvn/yii2-ajaxcrud 1.0.6 requires johnitvn/yii2-ajaxcrud-assets 1.0.* -> no matching package found.
- johnitvn/yii2-ajaxcrud 1.0.5 requires johnitvn/yii2-ajaxcrud-assets * -> no matching package found.
- johnitvn/yii2-ajaxcrud 1.0.4 requires johnitvn/yii2-ajaxcrud-assets * -> no matching package found.
- johnitvn/yii2-ajaxcrud 1.0.3 requires johnitvn/yii2-ajaxcrud-assets * -> no matching package found.
- johnitvn/yii2-ajaxcrud 1.0.2 requires kartik-v/yii2-mpdf v1.0.0 -> no matching package found.
- johnitvn/yii2-ajaxcrud 1.0.1 requires kartik-v/yii2-mpdf v1.0.0 -> no matching package found.
- johnitvn/yii2-ajaxcrud 1.0.0 requires kartik-v/yii2-mpdf v1.0.0 -> no matching package found.
- johnitvn/yii2-ajaxcrud 2.0.8 requires kartik-v/yii2-mpdf ^1.0.0 -> satisfiable by kartik-v/yii2-mpdf[1.0.0.x-dev].
- johnitvn/yii2-ajaxcrud 2.0.9 requires kartik-v/yii2-mpdf ^1.0.0 -> satisfiable by kartik-v/yii2-mpdf[1.0.0.x-dev].
- Conclusion: don't install kartik-v/yii2-mpdf 1.0.0.x-dev
- Installation request for johnitvn/yii2-ajaxcrud * -> satisfiable by johnitvn/yii2-ajaxcrud[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 2.0.0, 2.0.1,2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9].

Potential causes:

Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

Installation failed, reverting ./composer.json to its original content.

error upon installing using composer

I tried to install using composer. There seems to have a problem.
Command: composer update --prefer-dist

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- johnitvn/yii2-ajaxcrud 1.0.3 requires johnitvn/yii2-ajaxcrud-assets * -> s
atisfiable by johnitvn/yii2-ajaxcrud-assets[1.0.0, 1.0.1, 1.0.2, 2.0.0, dev-mast
er].
- johnitvn/yii2-ajaxcrud 1.0.4 requires johnitvn/yii2-ajaxcrud-assets * -> s
atisfiable by johnitvn/yii2-ajaxcrud-assets[1.0.0, 1.0.1, 1.0.2, 2.0.0, dev-mast
er].
- johnitvn/yii2-ajaxcrud 1.0.5 requires johnitvn/yii2-ajaxcrud-assets * -> s
atisfiable by johnitvn/yii2-ajaxcrud-assets[1.0.0, 1.0.1, 1.0.2, 2.0.0, dev-mast
er].
- johnitvn/yii2-ajaxcrud 1.0.6 requires johnitvn/yii2-ajaxcrud-assets 1.0.*
-> satisfiable by johnitvn/yii2-ajaxcrud-assets[1.0.0, 1.0.1, 1.0.2].
- johnitvn/yii2-ajaxcrud 2.0.0 requires johnitvn/yii2-ajaxcrud-assets 1.0.*
-> satisfiable by johnitvn/yii2-ajaxcrud-assets[1.0.0, 1.0.1, 1.0.2].
- johnitvn/yii2-ajaxcrud dev-master requires johnitvn/yii2-ajaxcrud-assets *
-> satisfiable by johnitvn/yii2-ajaxcrud-assets[1.0.0, 1.0.1, 1.0.2, 2.0.0, dev
-master].
- johnitvn/yii2-ajaxcrud 2.0.1 requires johnitvn/yii2-ajaxcrud-assets 2.0.*
-> satisfiable by johnitvn/yii2-ajaxcrud-assets[2.0.0].
- johnitvn/yii2-ajaxcrud 1.0.0 requires kartik-v/yii2-mpdf v1.0.0 -> satisfi
able by kartik-v/yii2-mpdf[v1.0.0].
- johnitvn/yii2-ajaxcrud 1.0.1 requires kartik-v/yii2-mpdf v1.0.0 -> satisfi
able by kartik-v/yii2-mpdf[v1.0.0].
- johnitvn/yii2-ajaxcrud 1.0.2 requires kartik-v/yii2-mpdf v1.0.0 -> satisfi
able by kartik-v/yii2-mpdf[v1.0.0].
- johnitvn/yii2-ajaxcrud-assets 1.0.0 requires kartik-v/yii2-mpdf v1.0.0 ->
satisfiable by kartik-v/yii2-mpdf[v1.0.0].
- johnitvn/yii2-ajaxcrud-assets 1.0.1 requires kartik-v/yii2-mpdf v1.0.0 ->
satisfiable by kartik-v/yii2-mpdf[v1.0.0].
- johnitvn/yii2-ajaxcrud-assets 1.0.2 requires kartik-v/yii2-mpdf v1.0.0 ->
satisfiable by kartik-v/yii2-mpdf[v1.0.0].
- johnitvn/yii2-ajaxcrud-assets 2.0.0 requires kartik-v/yii2-mpdf v1.0.0 ->
satisfiable by kartik-v/yii2-mpdf[v1.0.0].
- johnitvn/yii2-ajaxcrud-assets dev-master requires kartik-v/yii2-mpdf v1.0.
0 -> satisfiable by kartik-v/yii2-mpdf[v1.0.0].
- Conclusion: don't install kartik-v/yii2-mpdf v1.0.0
- Installation request for johnitvn/yii2-ajaxcrud * -> satisfiable by johnit
vn/yii2-ajaxcrud[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 2.0.0, 2.0.1,
dev-master].

Note. I already installed kartik-v/yii2-mpdf. It's already in its latest release.

delete is not working

Hi John,

I tried to install and generate a model using your yii2-ajaxcrud. The Update and View is working fine but not with delete. I tried in Firefox and Chrome but delete did not work for both. I like this extension so much, but I am really frustrated since delete is not working. I did not change anything on the code yet. The prompt message is pop up but when "Delete" button is clicked nothing is happened!

Can you help me on this?

I check with my ModalRemote.js

this.addFooterButton = function (label, type, classes, callback) { buttonElm = document.createElement('button'); buttonElm.setAttribute('type', type === null ? 'button' : type); buttonElm.setAttribute('class', classes === null ? 'btn btn-primary' : classes); buttonElm.innerHTML = label; var instance = this; $(this.footer).append(buttonElm); if (callback !== null) { $(buttonElm).click(function (event) { callback.call(instance, this, event); }); } };

Additionally, in chrome delete is also not working

turn off modal

Is it possible to turn off modals and make link to open on another page (with loading all of the widgets)?

setting pjax:false just turns off pjax rendering.

Thanks

Create document

Create document for data blind in extension
Create guide for add bulk action buttons
Create guide for add toogle column

Size change don't work

Modal.remote.js:26
this.dialog - $(modalId).find('.modal-dialog');
instead of
this.dialog = $(modalId).find('.modal-dialog');

No i18n support for button

class BulkButtonWidget extends Widget{
...
$content = '<div class="pull-left">'. '<span class="glyphicon glyphicon-arrow-right"></span>&nbsp;&nbsp;With selected&nbsp;&nbsp;'. $this->buttons. '</div>';
....

must be something like this:
$content = sprintf('%s%s&nbsp;&nbsp;%s:&nbsp;%s%s', '<div class="pull-left">', '<span class="glyphicon glyphicon-arrow-right"></span>', \Yii::t('yii2crud', 'With selected'), $this->buttons, '</div>');

kartik-v/yii2-editable

Latest version is kartik-v/yii2-editable: 1.7.3 (which includes important updates). Please update this package when you can.

Datepicker widget

Hallo! Thanks you for you extension. I found a bug:

If I add datepicker in filter for some field it will work only for first selection. In connected with calling this line of code:
$('#contractsearch-datedoc').datepicker($.extend({}, $.datepicker.regional['ru'], {"dateFormat":"yy-mm-dd"}));

this line is called on page load. But it must be called every time when content in crud is updated (this line makes datepicker work).

Sorry for my english:)

Loading modal not shown on Chrome

Loading modal not shown on google chrome (or showed only after post request process finished).
This problem is caused by the async property on doRemote is set to false, and it makes beforeRemoteRequest.call(instance); call delayed right after the post request process finished.

Cannot change message confirmation?

How to change message confirmation on deleteOptions in gridview?
i follow this setting, but noting change.

'deleteOptions'=>['role'=>'modal-remote','title'=>'Delete',
'data-confirm'=>false, 'data-method'=>false,// for overide yii data api
'data-request-method'=>'post',
'data-toggle'=>'tooltip',
'data-confirm-title'=>'Hello?',
'data-confirm-message'=>'Hello Kirenius'],

Compatibility with kartik/widgets

How can we use kartik widgets in the forms with your extension ? Even renderAjax for the content does not load the form. Can you point me in the right direction?

Export button is not working

When user clicks the export button nothing happens. I've installed it in many different application and It never works. Could it be an issue with Kartik widgets?

Changing IDs of table and modal

Is it possible to change the default IDs of them? Trying to make multiple modals in one page...
Looks like they are hard-coded in .js..
Thanks.

Class 'johnitvn\ajaxcrudasset\CrudAsset' not found

After upgrading from 1.0.4 to 2.0.2 through composer, I've not been able to get it up and running anymore. It stops working with the message:
Class 'johnitvn\ajaxcrudassets\CrudAsset' not found

I've created pull request #20 with a fix.

Compatibility with kartik/widgets

Your generation of index file was based to kartik gridview. Are the other widgets of kartik compatible with this module? I tried to migrating kartik's widget to yours. I tried select onto the form builder, but it
does not load the widget.

capture

Different text in BulkButtonWidget

I add variable in class BulkButtonWidget
public $text

and in function

                if(!$this->text) $this->text='<span class="glyphicon glyphicon-arrow-right"></span>&nbsp;&nbsp;With selected&nbsp;&nbsp;';
        $content = '<div class="pull-left">'.
                   $this->text.
                   $this->buttons.
                   '</div>';

Update composer.json to

Can you update the requirement to allow kartik-v/yii2-grid >3.04 ?
your latest version of this extension
requires kartik-v/yii2-grid 3.0.4

Search in GridView does not work with ajax

When I search something in GridView first time, it works but when I do it second time it does not search and crashes and I get this error in js console.
Uncaught TypeError: Cannot read property 'filterSelector' of undefined

$.each($(settings.filterSelector).serializeArray(), function () {
2016-06-29_14-43-38

pagination

I try to add more than ten rows and still they are in one page.

Does the gridview has pagination?

1.0.3 version not stable package found

Hi,
After separating the code into a different repo, the yii2-ajaxcrud-assets has no stable release, so it is not possible to install yii2-ajaxcrud v1.0.3 because this dependency.

Also:
Why are you separating those assets in a different repo?

Thanks

Widgets in crate modals

Hi, i'm using karik widgets in the create forms. If i go directly to the create action all widgets work as expected, but if i click the add button in the gridview and the create form loads in the corresponding modal, the form loads ok but widget dont work. It isn't loading assets for de widgets.

To solve this, simply change the method renderPartial() for renderAjax() for the sections marked as "Process for ajax request" in src\generators\default\controller.php

Add process toggle column

Some time we want to add toogle column for boolean field.
Examples: Active/Inactive, Block/Nonblock fields

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.