vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

Sorting And Pagination together on tables #400

Closed BhuvanaSanthoshkumar closed 7 years ago

BhuvanaSanthoshkumar commented 8 years ago

Still there is no support on pagination and sorting on tables? I implemented Pagination but sorting not working properly

Voxis commented 8 years ago

Here is my two cents: I can actually do sorting and pagination together... Here is the link A JSFiddle Example It uses another directive called "dirPagination" from AngularUtils & updated AngularJS version to 1.4.8 Modified the base code from angular xeditable's table row edit.

The problem I have is that, the edit mode does not "close" when the item being edited goes to another page.

Scenario 1:

Edit and second Item (User 2) and click on the Name sorting link at the top of the table. You can see that User 8 is in edit mode now.

Scenario 2: Delete items until it only have 5 , and do the Scenario 1. If the item being edited is still in the page. the edit mode does not follow

Maybe it is also caused by some other libraries. so i dont know.

My question is: is there a scope flag in the library so it tells you there are some items in edit mode. So that at least I can check this flag to prevent sorting.

atodicebear commented 8 years ago

Hey, did you found a solution for Edit with Pagination? Iam using as well dirPagination and the Problem is Editing something in Page1 then changing to Page 2 it delete/forgets the Changes. Somehow to remember it? 1) Dirty just to call save allways after changing Pages 2) Just remember Changes

atodicebear commented 8 years ago

@ckosloski Something you are working on wiht Pagination or how to Save the Edited Fields while Changing the Page with Pagination?

ckosloski commented 8 years ago

No, not currently working on that. Pull requests are welcome :)

atodicebear commented 8 years ago

@ckosloski How can I read the Values of the generated TextFields? Because you use you "e-name.." and so on and not "ng-model". Because I want to read from every TextField the Data and save them allways onLeaveOfTextField or PageChange in a Factory. If user wants to save then it gets the Data from the Factory. Is there something implemented as "ng-change" as in Normal Textareas? https://docs.angularjs.org/api/ng/directive/textarea This could be helpfull

ckosloski commented 8 years ago

I think what you need to do is to submit the form on page change so that it saves the values. If you don't want to save the values, maybe you could try adding an onchange event to keep track of all the values and then save them manually. Also, maybe inspect the editable form object (i.e. rowform). I think it contains an array of the items on the form ($editables). Not sure if it has anything useful or not.

atodicebear commented 8 years ago

I tried with "save on page change" but it didnt do the Trick. The Values were deleted faster as the save came. This on Change is what I want to do now. With normal Textareas its working through ng-model+ng-change. But your Editable Textareas dont accept neither ng-model or ng-change. That was the question If it has something implemented like "ng-change/e-change?"

ckosloski commented 7 years ago

You can add e-ng-change to a textarea.

ckosloski commented 7 years ago

@atodicebear are you still having issues?

atodicebear commented 7 years ago

@ckosloski If i remember correctly I did a workaround with a Factory Method which just saved the Values with e-ng-change and after saving/cancel just delete everything to clear the Factory.

But Im not anymore a Member of this Project so for further Questions or Codesnippets I cant help anymore, sorry.

ckosloski commented 7 years ago

@eugef I think this issue can be closed.