Auto reload after update + select list

(8 posts) (2 voices)

Tags:

No tags yet.

  1. duane, Member

    Hi,

    I've made an editable report and it works fine to update the edited value and show it is updated. However the value updated has an impact on other (non-summary) columns. How can I also get it to reload the whole page? I can manually use the reload button and I can set the dbr.refresh value - but both are clunky for my purposes: I only want the who page reloaded after an update.

    Second - I've tried to use a 'select' type on the in-place editable form, yet it doesn't seem to display. Am I right to expect that a 'select' list is a drop-down list with a value and a label (as per normal html)? I ask because example at http://www.mydbr.com/doc/content/cmd.editable.html seems to show the 'select' value NOT as a drop-down.

  2. myDBR Team, Key Master

    I've made an editable report and it works fine to update the edited value and show it is updated. However the value updated has an impact on other (non-summary) columns. How can I also get it to reload the whole page? I can manually use the reload button and I can set the dbr.refresh value - but both are clunky for my purposes: I only want the who page reloaded after an update.

    You've got few options here. Easiest way is to force page reload after edit (by adding page realod js script into editing procedure), but it can disturb user a bit when page reloads after each update.

    Another, and a better way to do it, is to use myDBR's editing callback-function which is a javascript function you define. The function gets editable cell as a parameter and you can finetune the cells to be updated based on edited cell.

    Second - I've tried to use a 'select' type on the in-place editable form, yet it doesn't seem to display. Am I right to expect that a 'select' list is a drop-down list with a value and a label (as per normal html)? I ask because example at http://www.mydbr.com/doc/content/cmd.editable.html seems to show the 'select' value NOT as a drop-down.

    "select"-type is a popup and should work just fine. See "Editing example 2" at:

    http://mydbr.com/demo/mydbr/report.php?r=77&m=1&h=25541008f09ce098a477425247b8c6ef47ff7377

    --
    myDBR Team

  3. duane, Member

    Thanks - I'll try out the js reload for now because it is a simple page (so far).

    As for the select type, I've tried to follow the example but still don't get the select list. What I have is:
    SELECT 'dbr.editable', 3, 'sp_DBR_admin_update_org', 'inOrg=3', 'inLogin=2', 'type=select', 'select=select id, label from report_organisations';

    SELECT regOrgName AS 'Current Org',
    inLogin AS 'Current User',
    r.organisation as 'Switch To'
    FROM tool_registrations r
    WHERE r.user = inLogin;

    I'm trying to provide a list of organisations in column 3 from which to select and then update the appropriate row.

  4. myDBR Team, Key Master

    Couple of things to fix in update:

    1) The r.organisation should be the 'label' from the 'report_organisations' so that the report would show data in user readable form
    2) You should probably pass the regOrgName as parameter to "sp_DBR_admin_update_org" so you know what row to update. The sp_DBR_admin_update_org would then have three parameters: inOrg & inLogin to specify the row and inOrgSwitchTo (or whatever you like to call it) as user selected paramerer.

    See examples and documentation for the correct syntax.

    --
    myDBR Team

  5. duane, Member

    Hmmm - not sure where I am going wrong - I can get it working find when I just have a list of the raw values (the id) but the point is to get a human readable listing. So I've simplified (below) and used 'label' as you suggest (obtained via a join since it isn't in the tool_registrations table - that only stored the id value)

    SELECT 'dbr.editable', 1, 'sp_DBR_admin_update_org', 'inOrg=1', 'inLogin=2', 'type=select', 'select=select id, label from report_organisations';

    SELECT label AS 'Current Org',
    inLogin AS 'Current User'
    FROM tool_registrations r
    INNER JOIN report_organisations ON r.organisation = report_organisations.id
    WHERE r.user = inLogin;

    Any further suggestions? Anything else I can provide to shed light on the possible issues?

  6. myDBR Team, Key Master

    Hi,
    The correct form would be something like:

    SELECT 'dbr.editable', 3, 'sp_DBR_admin_update_org', 'inOrg=1', 'inUser=2', 'type=select', 'select=select id, label from report_organisations';
    
    SELECT o.label AS 'Current Org',
    inLogin AS 'Current User',
    o.label AS 'Switch To'
    FROM tool_registrations r
    INNER JOIN report_organisations o ON r.organisation = o.id
    WHERE r.user = inLogin;

    whereas sp_DBR_admin_update_org would be of form:

    create procedure sp_DBR_admin_update_org (
    inOrg int,
    inUser varchar(30),
    inOrgSwitchTo int
    )
    begin update tool_registrations
    set organisation = inOrgSwitchTo
    where user = inUser and organisation = inOrg; end

    --
    myDBR Team

  7. duane, Member

    Nope - still doesn't work - even cutting and pasting directly (and other variants). All that ever happens is that when I enter the cell for editing it goes blank. I'll keep fiddling, but am a bit at a loss as to what to do.

  8. myDBR Team, Key Master

    Without access to your setup it is hard to tell what causing this for you.

    Make sure that the editable report exists and that your select list query "select id, label from report_organisations" does indeed return correct rows. Also, take a look at the examples and compare what is different in your setup.

    --
    myDBR Team


Reply

You must log in to post.