Welcome Guest, Not a member yet? Register   Sign In
CRUD Using jQuery and Codeigniter Series
#1

[eluser]iFadey[/eluser]
Part 1
How to use jQuery with Codeigniter.
How to send Ajax request to perform READ operation.
How to use jQuery UI tabs widget.
How to use Microsoft’s jQuery templating plugin.


Part 2
Displaying Ajax loader animation when an Ajax call is made.
How to inject Update/Delete link in each record using jQuery.
How to use jQueryUI dialog widget.
How to send Ajax request to perform DELETE operation.
How and when to use jQuery’s delegate method to bind events.


Part 3
How to filter form values to prevent XSS attack.
What jQuery serialize method do and how to use it.
How to send Ajax call to perform UPDATE operation using POST method.
How to use jQuery advance selectors to update table rows.


Part 4
How to perform Ajax based CREATE operation.
How to switch jQuery tab programmatically.


Part 5
In this part you will how to perform form validation using jQuery.


Part 6
In this part you will learn how to perform clientside search, table sorting, limit records display at a time, and clientside pagination using jQuery.
#2

[eluser]muhax[/eluser]
Thank you very much.
This is DA BOMB Smile.
#3

[eluser]iFadey[/eluser]
Your welcome Smile
#4

[eluser]muhax[/eluser]
You are saving people's jobs...Literally Smile.
#5

[eluser]iFadey[/eluser]
Thanks a lot for your appreciation muhax!
#6

[eluser]muhax[/eluser]
I have a question now Smile...

Ok, here is a scenario, and all I ask is what general steps are involved in this process, not the solution.

Scenario:
1. I have table 1 on the page with checkboxes next to each record;
2. I have table 2 on the same page;
3. I have "assign" link/button in between these two.
4. I chose several records from the first table by chosing checkboxes.
5. I click "assign" link/button
6. Records with checboxes checked from table 1 disappear (e.g., by preforming Delete operation of CRUD) and they appear in table 2 (e.g., by preforming Create operation of CRUD)

What are the general steps to achieve this with DataTables you used in your tutorial?
#7

[eluser]iFadey[/eluser]
1) Initialize a js variable to empty string and also create an empty array

2) Iterate over each row in table_1 and check for checked rows. Make a copy of checked row in array of objects. Also append the values of each row in string var using json format.
<code>{
row_id1: { name1: value1, name2: value2 },
row_id2: { name1: value1, name2: value2 }
}</code>
For more examples check this page: http://www.json.org/example.html


3) Send a single Ajax request with string containing rows in json format.

4) On serverside, decode the string using json_decode() function.

5) Now delete each record in database by iterating over that php array and also insert new record in table_2 using that decoded object.

6) Back to clientside. Remove rows from table_1 using DataTable function fnDeleteRow(). Pass index of each row to it to delete the row. Similarly add new rows in table_2 using DataTables function fnAddData(). Better check DataTable API for more details: http://www.datatables.net/api
#8

[eluser]Mr-H[/eluser]
hi ifadey thanks so much for this tut.
but i have a question
how to populate php variable with out using jquery template?
cause i dont wana display my data in a table but in a div <- seems all data returned from all.js in array and when i use {{each}} ...{{/each}} to separate data, it's not working
any help would be appreciated
#9

[eluser]muhax[/eluser]
I would also like to thank for the reply to my question in regards to DataTables.
One last thing I would like to ask is about your recommendations for JavaScript, Ajax, JQuerry books and tutorials. What helped you the most and what do you recommend. Also what would you suggest to someone who is starting in these technologies on how best to gain thorough knowledge, theoretical and practical as well. Thanks.
#10

[eluser]iFadey[/eluser]
@Mr-H: Your question is confusing. Actually jQuery template works on clientside and to store data in php variable, you need to post it on the server using Submit button or Ajax call.

@muhax: Check these books:

Pro PHP and jQuery
http://www.apress.com/book/view/9781430228479

jQuery: Novice To Ninja
http://www.sitepoint.com/books/jquery1/




Theme © iAndrew 2016 - Forum software by © MyBB