Code Igniter ExtJs Integration – 3

So far, we’ve been prepare for the first steps how to code igniter and extjs integration (you could read the detail at: Code Igniter ExtJs Integration part 2). On this article, I’ll show you more about managing data using code igniter and extjs. Before starting make our code, there are many configuration settings that we should do, here’s the to do list :

  1. Make sure for database connection setting.
    • Edit configuration file at : C:\xampp\htdocs\ci-ext\system\application\config\database.php
    • Provide the variable that match to your database settings
  2. Make sure to load all libraries that we need it
    • Edit configuration file at : C:\xampp\htdocs\ci-ext\system\application\config\autoload.php
    • Make sure that you already set the variable : $autoload['helper'] = array(’url’);
    • Make sure that you already set the variable : $autoload['libraries'] = array(’session’, ‘jsonci’);
    • Url helper will be very helpful for our template coding
    • Session library will be very helpful for managing user authentication (we will not discuss more about it, please send me a message when you have a question about it)
    • JsonCi library will be very helpful for managing JSON output to communicate between client and server. Actually, this library is code igniter plugin, you could download it [here], then you should place it in : C:\xampp\htdocs\ci-ext\system\libraries
  3. We’ll create 3 files, that will be described as below :
    • file M_activity.php located at : C:\xampp\htdocs\ci-ext\system\application\models
    • file V_activity.php located at : C:\xampp\htdocs\ci-ext\system\application\views\main
    • file C_activity.php located at : C:\xampp\htdocs\ci-ext\system\application\controllers
  4. We’ll create a table named “activity”, that will stored our data. You could download the SQL code [here] and create your database on your server.

Since you already done for all of the settings above, I’ll describe the features offered from this tutorial, here’s the detail features :

  1. Implementation for management data that well known as CRUD (Create Read Update Delete) using code igniter and extjs.
  2. Covered more about extjs grid component using grouping management, extjs form component, extjs form styling, extjs insert and update state form using window modal.
  3. Offered more user flexibility and really nice User Interface application
  4. More detail about MVC structured provides by code igniter

I think that should be more efficient to practicing it directly using sample application, you could download it [here]. Since your setup is done, you just directly goes to: http://localhost/ci-ext/index.php?c=main.

Here’s the screenshot detail about the sample application. Any question? you could leave a comment or email me : wachid[at]faqlist[dot]net


  • Share/Bookmark
About Pidgin Social Networking using Facebook

24 comments so far

  1. dwi
    #1

    hi. i try to put your code in my server. but i got this :

    ##########
    An Error Was Encountered
    Unable to load the requested class: jsonci
    ###########

    why it’s happens? any suggest? thanks.

  2. dwi
    #2

    i already change your file jsonCI.js to be jsonci.js because your file autoload was :
    $autoload['libraries'] = array(’session’, ‘jsonci’);

    but i still have this error

    ######
    An Error Was Encountered
    Unable to locate the model you have specified: m_activity
    #########

    but i see that, there is already file M_activity in system/application/model
    hope you can help me. thanks.

  3. wachid
    #3

    I assume, that you should already have C:\xampp\htdocs\ci-ext\system\libraries\jsonCI.php ??

    Your server ? Are you already change your default url in C:\xampp\htdocs\ci-ext\system\application\config\config.php ??

  4. dwi
    #4

    i already add your YM.please add me too. thanks

  5. susan
    #5

    Mas Wachid dari indonesia ya? abiz baca comment code-nya ada bhs.indonesia. langsung aja deh ^_^. nie udh nyoba yg tutorial diatas, tp kok muncul error ini yack?
    ____________________________________
    A PHP Error was encountered
    Severity: Notice
    Message: Undefined index: start
    Filename: controllers/C_activity.php
    Line Number: 21
    ____________________________________
    A PHP Error was encountered
    Severity: Notice
    Message: Undefined index: limit
    Filename: controllers/C_activity.php
    Line Number: 24
    ________________________________________
    A PHP Error was encountered
    Severity: Warning
    Message: Cannot modify header information – headers already sent by (output started at /var/public_html/dev/susan/ci-ext2/system/libraries/Exceptions.php:164)
    Filename: libraries/Jsonci.php
    Line Number: 52
    _____________
    mgk krn ga mengenali $_POST['start'] dan $_POST['limit'] ?? udh tak coba liat data Json-nya di :
    http://sub.domain.com/ci-ext2/index.php/C_activity/get_activity_datagrid
    tp yg muncul ya error td.. trus waktu tak jalanin malah blank.
    mohon pencerahannya suhu. arigato!!

  6. susan
    #6

    kayake statement ini :

    store_activity.load( {params:{start:0, limit:25}} );

    yang tidak terkenali waktu di $_POST['start'] sama $_POST['limit'] tapi gimana caranya supaya function get_activity_datagrid() bisa mengambil value ini? trims ya. cheers

  7. wachid
    #7

    Well, you’ve got me (Good point, though), hehehe… I’m actually from Indonesia, but I was under this site agreement, that I must use English for any activity in http://faqlist.net, I’m sorry for this inconvenient.

    Well, I’m sure that you didn’t downloaded the new version files based on my latest article (or you already did it?), but you should updated the file “…\ci-ext\system\libraries\jsonCI.php”, because I’ve made some changes.

    For this version, you can’t make a request based on URL friendly pattern. Because it was set using “enable_query_strings” configuration, that’s why you just type the URL like : “…/ci-ext/index.php?c=main”

  8. susan
    #8

    i already download your latest source code, for information: i run with the Linux enviroment using Daryna (Ubuntu looks like), any change if i run your code into Linux or Unix environment??
    i try to pass the the value $_POST['start'] and $_POST['limit'] in your system/application/controller/C_login.php and this is work (but, all record are show), i think that my problem is still i can’t read param value (start and limit) from C_login.php but i don’t why.. Thanks for your help.

  9. susan
    #9

    sori.. i mistake for the upper post.
    it must be : system/application/controller/C_activity.php

    thanks.

  10. wachid
    #10

    I think this problem is probably depends on your PHP configuration settings. I’m sure that my code is work under Linux / Unix environment.

    For this code statement : store_activity.load( {params:{start:0, limit:25}} );
    You could see the request header method when you’re using firebug on your Firefox browser.

    $_POST['start'] and $_POST['limit'] will take some effect when you have more than 25 records on your database (paging system navigation).

    You could just write your post / comment in Indonesian language. :) Cheers.

  11. Roy
    #11

    Hi, quite impressed by the work you have done. However, i do not quite understand how to use the session in php with extjs.

    Could provide some example?

  12. wachid
    #12

    Hi, Roy. nice to meet you. I’ll write the example soon.

    What kind of session example do you want? It’s kind of login example?

    Cheers

  13. purwo
    #13

    Hai..nice app.

    But i newbie with CI and i try to build login session but still have error. Could you provide some session login example ?

  14. wachid
    #14

    Please provide some error, maybe I can help you.

    Thanks.

  15. Praetorian
    #15

    What is Passwrod & LOGIN for the demo source.. it dosnt work :( pls help.. :) thx

  16. Praetorian
    #16

    Ow.. Sowwie NP.. i didnt read this line

    Since you already setup all the environment, you just directly goes to: http://localhost/ci-ext/index.php?c=main.

    I think. Demo Login still dont wrok.. :D

  17. wachid
    #17

    I’m sorry about that, I prefer to share that pieces depends on your favorite login validation method…

    I’ll write some explanation about that soon… I just concern for the main application first (grid, menu, crud model)

  18. nsdRight_Click
    #18

    Hi wachid! great job, sample nice..do you have session sample, like log-in?

  19. co01est
    #19

    nice post and keep posting.

  20. wachid
    #20

    Thanks…

    @nsdRight_Click : I’ll try to make it soon… Or may be you could share about your experience?

  21. mnemonic
    #21

    Nice posting, but i’m still confuse to begin building site with CI+Extjs :D

    i hope you can make a new easy samples about posting,add data,update data, del data and view data :D

    oh about your demo, i cant change date value, there is still 1 jan 1970

  22. PROGY
    #22

    wachid…? where are you now.
    i’m stuck with this..
    please..do more

  23. songbee
    #23

    I has been download your example ci-ext-demo.zip n can be run. But, have a little problem.
    1. Open Panel “Manage Activity”
    2. Click Add New, but I cancel to add new data with click Close button on Add New Window.
    3. Click Quit button.
    4. Open Panel “Manage Activity” again. And Click Add New, then you will see the window Add New nothing “textfield”.
    So solutions which can be shared??
    Thanks very much to Mas Wachid.

  24. wachid
    #24

    I’ve realize that bug.. I think that it’s all about my little mistake. Thanks for reminds me about that :) .

    I’ve made the update. Please refer to this file: ci-ext.zip

Leave a Reply





XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

2 Trackbacks/Pings