This topic is locked
[SOLVED]

 Re-sort list after inline add

2/4/2010 6:36:45 AM
PHPRunner General questions
B
BenjaminJ author

Hello,
I'm new to PHPRunner and to this forum. I've found a lot of responses here but I need a trick for a little problem.
I use inline edition in a list page.

This list page presents records from one table, and the query is "ordered by" a field(numeric) of this table, and is displayed has a colomn in the list page.
When the user add a new row via the "Inline Add" button and then validates it, I want the whole list re-ordered according to the filter defined in the Query.

Unfortunately, the last inserted record stays on top of the list and the only way to sort the list again is a manual refresh of the page by the user...
I tried using the "AfterAdd" event to redirect to the same page but it doesn't work (=it produces an "Error occurred >>" link that pops-up the desired page).
-1) Any suggestion ?
-2) A workaround could be, in my case, to have the "inline add row" to be situated at the bottom of the list but I didn't find a way to to this either... Is this possible?
Thanks in advance for your help,

Benjamin.

J
Jane 2/4/2010

Benjamin,
to refresh page after InlineEdit/InlineAdd open generated inlude/inlineedit.js file, find this code:

setTimeout('$("#uploadForm'+id+'").remove()',500);



and add following code just after:

setTimeout('window.location.reload(true)',1000);
B
BenjaminJ author 2/4/2010

Perfect!

Thanks a lot for this rapid and efficient help...
B.

B
BenjaminJ author 2/24/2010

Hello,
I would like to update this post and resquest for another solution...

The given solution worked well only if you edited one line at a time, since, with the modification, the first "save" triggers a refresh that cancels all other editions...
I just updated to PHPRunner v5.2 and I now use the same "ordered" page included in its master table (inline edition of details in master list page).

Since I want users to be able to re-order the details records that appears inline, I added two buttons to the list page of the detailed rows : "Move-up selected" and "Move-down selected".

These buttons appear "inline" near by the [Addnew], [Edit selected] & [Delete selected].
The server code of these two buttons updates the database and works well, but after this, I would like detail rows to be refreshed (=re-sorted).

Is there a javascript code that I can insert in the "Client After" event of each button to refresh the detail lines?
It should be possible since this subpart of the page is already refreshed when you delete a line; but I couldn't find the appropriate code do make it working...
Any help appreciated...

Benjamin.

B
BenjaminJ author 2/26/2010

No idea?
I tried a lot of things without success...

I really think there is a solution to refresh the lines of details editable inline in the master table.
I need it because the order of these lines is very important in my application, and after edition & add I need this part of the page to be refreshed. I also use two buttons to move selected lines up and down, and so, once the database is updated, I need them to be reordered on screen.

I cannot refresh the whole page because it closes the "inline detail panel".
I see in the source code, some functions like "dpInline1.showDPInline" but I don't get anywhere...

After deletion, this part of the page is well refreshed, so I think I just need the part of code used there.
Can someone help me with this issue?
Thank a lot,

Benjamin.

B
BenjaminJ author 3/1/2010

Is this so complicated? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=48144&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />