Welcome Guest, Not a member yet? Register   Sign In
Codeigniter with Ajax or jQuery...
#1

[eluser]haris244808[/eluser]
Hi there i have a data that i fetch with codeigniter(php) from the database and show them to the Table1 ... Using jQuery i move them to the Table2...but after a refresh the moved data are back at the Table1...

Now what i want to do is that when i move a <tr>table row</tr> from Table1 to the Table2...and i refresh the page...the moved Rows stay still to the Table2...

Can anyone help me achieve this??
#2

[eluser]TheFuzzy0ne[/eluser]
You need some way for your page to remember what rows have been moved. Maybe you could set it in a cookie, or store it server-side in the session?
#3

[eluser]haris244808[/eluser]
[quote author="TheFuzzy0ne" date="1363356253"]You need some way for your page to remember what rows have been moved. Maybe you could set it in a cookie, or store it server-side in the session?[/quote]

can you give me some helpful links from where i can start...?
#4

[eluser]TheFuzzy0ne[/eluser]
http://lmgtfy.com/?q=javascript+cookie
#5

[eluser]haris244808[/eluser]
[quote author="TheFuzzy0ne" date="1363357755"]http://lmgtfy.com/?q=javascript+cookie[/quote]

Is tehre any way i can do this with Codeigniter PHP or i must use Javascript or Ajax...

Ok you can see my case in the picture i uploaded...

AS you can see when i move even all the files to the Table2...pagination is still there... i think even with cookies i cannot solve that... Can you help me solve this case?
I want to move all the files and depending on files left, also the pagination to be shown properly...and after the refresh Moved files to dont go back to the intial table...


The jQuery i am using to move files:
Code:
$(document).ready(function() {
   $(".accept").click(function () {
       var row = $(this).closest("tr");
       var table = $(this).closest("table");
       row.remove();
       if (table.is("#table1")) {
           $("#table2").append(row);
       }
       else {
           $("#table1").append(row);
       }
       row.fadeOut();
       row.fadeIn();
   });
  });
#6

[eluser]kostyak[/eluser]
Hi! It is very interesting task to move rows between tables. May be if you explain why it is necessary in you situation we will give your much better solution?
#7

[eluser]haris244808[/eluser]
[quote author="kostyak" date="1363379463"]Hi! It is very interesting task to move rows between tables. May be if you explain why it is necessary in you situation we will give your much better solution?[/quote]

Because when i move to the next table i want to hide existing Action Links and add other links...such as Edit
#8

[eluser]kostyak[/eluser]
[quote author="haris244808" date="1363383274"][quote author="kostyak" date="1363379463"]Hi! It is very interesting task to move rows between tables. May be if you explain why it is necessary in you situation we will give your much better solution?[/quote]

Because when i move to the next table i want to hide existing Action Links and add other links...such as Edit [/quote]

And why not to simply change these links in existing table? Why your first table must to be replaced? May be the best solution it is another solution if you revise your main task?

To prevent long discussion, I have to say that if you want to save new table after reloading with CI, than all your changes must to be completed in the CI (on the server). So after changes - you need somehow to push a save command to your server-side code in CI.
#9

[eluser]haris244808[/eluser]
[quote author="kostyak" date="1363386734"][quote author="haris244808" date="1363383274"][quote author="kostyak" date="1363379463"]Hi! It is very interesting task to move rows between tables. May be if you explain why it is necessary in you situation we will give your much better solution?[/quote]

Because when i move to the next table i want to hide existing Action Links and add other links...such as Edit [/quote]

And why not to simply change these links in existing table? Why your first table must to be replaced? May be the best solution it is another solution if you revise your main task?

To prevent long discussion, I have to say that if you want to save new table after reloading with CI, than all your changes must to be completed in the CI (on the server). So after changes - you need somehow to push a save command to your server-side code in CI.[/quote]

becausei have accept and reject...if the file is accepted i want to move that to the 2nd table and enable some other actions...when it is rejected it will go somewhere else...
#10

[eluser]kostyak[/eluser]
So if you want to change state of the records you can use more simple procedure.
1. Add column to your table with these records, for instance 'State' (enum: 'pending','accepted','regected')
2. Set default value - pending
3. Make 3 table views for different states.
4. Than by clicking at the row in the pending table – do not move records directly. Instead change state at the server side in CI
5. After each change you have to refresh views and will see changes. This action you can make in two different ways:
a. By reloading entire page
b. By updating only changed tables through ajax technique.




Theme © iAndrew 2016 - Forum software by © MyBB