Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Reorder/resequence rows in a report
Reorder/resequence rows in a report [message #201150] |
Thu, 02 November 2006 16:34  |
rleishman
Messages: 3728 Registered: October 2005 Location: Melbourne, Australia
|
Senior Member |
|
|
How do you write a report where you can move rows up and down?
Background
In the Application Express programming interface, there is a nice feature where you can click up(^) and down(v) arrows to resequence rows in an HTML table. When you click the arrows, it doesn't submit the page, it just uses JavaScript to dynamically move the row on the page. Then, when you "Apply Changes" there is some internal cleverness whereby it saves the modified sequence to the database.
I want to create a similar interface in an application I am writing with ApEx. It pulls back the rows of the table order by (say) column SEQ_NO. I want to use the up and down arrows to resequence the items without a submit, and then write back the rows with updated values in the SEQ_NO column.
What I've done so far
I have found the piece of javascript that the programming interface uses. I managed to attach it to a report field using the LINK feature on the report field, and linking it to a non-existent anchor on the page.
<A HREF="#nowhere" onclick="html_RowUp(this,true);reorder_set();" class="pb" alt=""><IMG.../></A> So when you click the link, it runs the onclick() event rather than returning to the server. This is a bit clunky, but a LINK was the only place I could find to attach JavaScript to a report column.
Where I need help
My next step is to work out how to write the new sequence numbers back to the database. I'm going to get APEX to build an updateable report and see if I can reverse engineer how it does multi-row write-back.
I'd also like a less clunky way to place the up and down arrows in the report. I have looked at the HTML that the programming interface generates for its resequencer, and the up/down arrows don't even appear in the table rows ...? I suspect that they are somehow built into the table automatically via a Class, but my HTML/Javascript/CSS isn't good enough to work it out.
If it is simply a class, I can probably tap into it by customising a template.
If anyone's done it and can give me some pointers, or a link to a How-to doc of some kind, I'd appreciate it.
Ross Leishman
|
|
|
|
|
|
|
Goto Forum:
Current Time: Thu Jun 05 21:28:17 CDT 2025
|