Search code examples
coldfusioncoldfusion-2018

How to output entire dataset but "focus" on a specific known row number


I am currently outputting a dataset as an HTML table with each record linked to a page where that record can be edited. After the edit process the user is taken back to the list with the first record being the one they just edited. Now the client would like to see the entire data set but have the list "focused" on the edited record so that they can scroll either forward or backward from there. It would be best if the dataset didn't have to be reloaded.

I'm using SQL Server row_number() function to establish the row number of the record edited. Also using ColdFusion 2018 server.

<cfquery datasource="census" name="theData">
WITH cte_heads AS (
    SELECT
        ROW_NUMBER() OVER (
        ORDER BY lastname, firstname, year
        ) row_num, refno,firstname,lastname,year, family
        FROM census INNER JOIN relationship ON census.relationship = relationship.relationshipID
        WHERE relationship = 34 AND lastName LIKE '#nameStart#%'
        ) SELECT *
        FROM cte_heads
        WHERE row_num  >= #url.row#


Solution

  • Jim,

    We can use jQuery plug-ins to edit the dataset rows in-line.

    Here is an example that suits your requirements: https://www.jqueryscript.net/demo/table-editing-creation-bootstable/

    Please remember that the editing dataset information on the client-side might lead to data loss or improper data when multiple people using the same page concurrently.