Part of the EllisLab Network
   
1 of 5
1
Jqgrid CRUD 1.1[NEW]
Posted: 08 June 2010 11:41 PM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  26
Joined  04-08-2007
Current version1.1
New Features
Export data to csvxmlPDF
Jqgrid 3.7.2

General features
-List result
-add/delete/edit/search result
-Pagination
-jquery UI skins 

Hi friends.

I was looking for a good crud for CodeIgniter, but found none.
So, I’ve been working on one that I work well and are easy to implement.

I’m using jqgrid, like frontend.

You can check the DEMO smile
======= SOURCE CODE ========

Overview
Basically, this CRUD library It arises from the necessity to provide basic administrative tasks and results display

Example

function index()
{

     $this
->load->library('datagrid');
     
$grid  $this->datagrid;            
            
     
$grid->addField('id');
     
$grid->label('ID');
     
$grid->params(array('align' => "'center'"
                         
'width' => 50,
                         
'editable' => 'false',
                         
'editoptions' => '{readonly:true,size:10}'
                         
)
                  );

      
$grid->addField('name');
      
$grid->label('Name');
      
$grid->params(array('width' => 300,
                          
'editable' => 'true',
                          
'edittype' => "'text'"
                          
'editrules' => '{required:true}'
                         
)
                    );

      
$grid->addField('created');
      
$grid->label('Created');
      
$grid->params(array('width' => 300,
                          
'editable' => 'true',
                          
'edittype' => "'text'"
                          
'editrules' => '{required:false,date:true}'
                          
)
                   );

       
$grid->addField('description');
       
$grid->label('Description');
       
$grid->params(array('width' => 300,
                           
'editable' => 'false',
                           
'edittype' => "'text'"
                           
'editoptions' => '{readonly:true,size:10}',
                           
'editrules' => '{required:false}'
                           
)
                      );


            
$select $this->db->select()->from('crud_relation')->get()->result_array();
            
$arrSelect = array();
            if(
false == empty($select)){
                
foreach($select as $item){
                    $arrSelect[]
= array($item['id'=> $item['description']);

                
}
            }
            $selectval  
=  $grid->jsonresult($arrSelect);
            
$selectval  $grid->jqgridSelect($selectval);
            
$grid->addField('relation_id');
            
$grid->label('Description');
            
            
$grid->params(array('align' => "'center'"
                                
'width' => 100,
                                
'hidden' => 'true',
                                
'editable' => 'true',
                                
'edittype' => "'select'",
                                
'editoptions' => '{value:":Select;' $selectval '",size:10}',
                                
'editrules' => '{edithidden:true,required:true,integer:true}'
                               
)
                          );

            
#GET url
            
$grid->setUrlget(site_url('welcome/getData/'));

            
#Set url
            
$grid->setUrlput(site_url('welcome/setData/'));

            
#show paginator
            
$grid->showpager(true);

            
#width
            
$grid->setWidth('600');
            
#height
            
$grid->setHeight('300');
            
#table title
            
$grid->setTitle('CRUD Example');

            
#show/hide navigation buttons
            
$grid->setAdd(true);
            
$grid->setEdit(true);
            
$grid->setDelete(true);
            
$grid->setSearch(true);
            
$grid->setRowNum(20);

            
#export buttons
            
$grid->setPdf(true,array('title' => 'Test pdf'));

            
$param['grid'$grid->deploy();
            
$this->load->view('crud',$param);
    
/**
 * Get data result as json
 */
public function getData()
{
    $this
->load->library('datagrid');
    
$grid      $this->datagrid;
    
$response  $grid->getData('crud_test', array(array('table' => 'crud_relation'
                                                         
'join' => 'crud_relation.id = crud_test.relation_id'
   
'fields' => array('description'))),array(),false);
    
$rs $grid->jsonresult$response);
    echo 
$rs;            
/**
* Put information
*/
public function setData()
{
   $this
->load->library('datagrid');
   
$grid       $this->datagrid;
   
$response   $grid->operations('crud_test','id');

======= VIEW DEMO ========

======= SOURCE CODE ========

Now is available the source code ======= HERE ========

Steps for implements in ours projects.
1)Copy the library (/system/application/libraries/Datagrid.php) in your project library application folder
2)Copy the view (/system/application/views/crud.php) in your views folders
3)Copy the JS’s libraries (/js/lib) into our JS folder.
4)Copy system/plugins/dompdf
and to_pdf_pi.php
   

thats it!

now visit http://www.trirand.com/jqgridwiki/, for learn to use the library datagrid.

I hope your comments.

Profile
 
 
Posted: 09 June 2010 02:02 PM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  19
Joined  01-08-2009

nice following… I started play around to do own admin CRUD, but looks like I really don’t have enough time now to make anything usefully. So I am waiting to see what you cooked up. So keep on going smile

Profile
 
 
Posted: 09 June 2010 06:55 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Avatar
Total Posts:  26
Joined  04-08-2007

Now u can see a Demo

Profile
 
 
Posted: 10 June 2010 05:52 AM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  19
Joined  01-08-2009

looking good.

Is your library doing the validation also and how to control that?

I can share one of the main point I had in my CRUD plan:
I like the way you can control the stuff, but most of the parameters could be be guessed from the DB table if table name was given. Then things like width, datatype, validation etc could be guessed from the table info (Sure leaving possibility to override settings)
This also makes possible to set up setting file to give default validation for certain datatypes etc…

Profile
 
 
Posted: 10 June 2010 12:03 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Avatar
Total Posts:  26
Joined  04-08-2007

off course, i would like know your suggestions and new funcionalities

Profile
 
 
Posted: 11 June 2010 02:40 PM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  1
Joined  06-11-2010

Hi vicman,

I have the same needs for non-profit organization.
would you mind to already share your library.
I’m very interested in test-driving this (and assist if/when needed)

Thanks,

Eric.

Profile
 
 
Posted: 11 June 2010 03:33 PM   [ Ignore ]   [ # 6 ]  
Summer Student
Avatar
Total Posts:  26
Joined  04-08-2007

sure, in a few days I’ll upload the source code.

Pacience wink

Profile
 
 
Posted: 30 June 2010 12:12 PM   [ Ignore ]   [ # 7 ]  
Summer Student
Avatar
Total Posts:  26
Joined  04-08-2007

Now is available the source code ======= HERE ========

Steps for implements in ours projects.
1)Copy the library (/system/application/libraries/Datagrid.php) in your project library application folder
2)Copy the view (/system/application/views/crud.php) in your views folders
3)Copy the JS’s libraries (/js/lib) into our JS folder.

thats it!

now visit http://www.trirand.com/jqgridwiki/, for learn to use the library datagrid.

I hope your comments.

Profile
 
 
Posted: 13 July 2010 02:05 PM   [ Ignore ]   [ # 8 ]  
Summer Student
Avatar
Total Posts:  26
Joined  04-08-2007

Someone has tested?

Profile
 
 
Posted: 13 July 2010 02:35 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  141
Joined  06-27-2010

demo looks good.

i just downloaded it, once i have it setup i will let you know how well it works out.

i was thinking of making my own. Not hard really, specially if you use a js framework like jquery.

if this works well enough, i might not have to make my own smile

 Signature 

“I Reject Your Reality and Substitute My Own” - Adam Savage, M5 Inc

Profile
 
 
Posted: 14 July 2010 09:52 PM   [ Ignore ]   [ # 10 ]  
Grad Student
Avatar
Rank
Total Posts:  32
Joined  08-05-2009

i tried demo and it’s great.

 Signature 

Computer Science Student
Freelance Application Developer
NuAzul
blogNuAzul

Profile
 
 
   
1 of 5
1