Render error while using editable with callback?

(8 posts) (3 voices)

Tags:

No tags yet.

  1. spyhunter88, Member

    Hi,

    Let see the picture of output and the code.

    /*Status Report */
    select 'dbr.editable', '[Status]', 'sp_DBR_INV_edit_status', 'inItemCode=Item_Code', 'inItemName=Item_Name', 'inStatus=Status', 'type=select', "select=select 'NORMAL' UNION select 'TRACKING' UNION select 'ALERT'", "options={'callback':update_status}";
    select 'dbr.javascript', "function update_status(value) {
    // alert(value);
    var url = '<img src=\"user/images/normal.jpg\" height=\"16\" width=\"16\">';
    if (value == 'ALERT')
    url = '<img src=\"user/images/bad_debt.jpg\" height=\"16\" width=\"16\">';
    else if (value == 'TRACKING')
    url = '<img src=\"user/images/tracking.jpg\" height=\"16\" width=\"16\">';
    $(this).html(url);
    }";
    
    select 	<code>Item_Code[Item_Code]</code>,
    	case
    		when c.Status = 'ALERT' then 'dbr.purehtml:<img src="user/images/bad_debt.jpg" height="16" width="16">'
    		when c.Status = 'TRACKING' then 'dbr.purehtml:<img src="user/images/tracking.jpg" height="16" width="16">'
    		else 'dbr.purehtml:<img src="user/images/normal.jpg" height="16" width="16">'
    	end as 'Status[Status]',
    ....

    And the output:

    I think this cause by the editable command or the callback options because the other one uses linked report works normal.

    Thanks,

  2. myDBR Team, Key Master

    Hi,
    the problem comes from the fact that you are passing along as a parameter the Status column which is already passed in as an automatic variable. Just leave it out.

    Also, instead of using img tag, you can use for a DIV which you style using CSS to include the image as a background.

    --
    myDBR Team

  3. spyhunter88, Member

    I don't understand your suggestion clearly. I remove the 'inStatus=Status' in parameter passing but the error occurs:
    'Edit report 'sp_DBR_INV_edit_status' requires parameter 'inStatus', which was not supplied. Column 0 will not be editable'.

    Anyway, the old version (4.2.3) works.

    Thanks,

  4. thang, Member

    I saw the error has been fixed in the latest build (v4.3.0, build 2489).

    Rgds,
    Thang.

  5. myDBR Team, Key Master

    I don't understand your suggestion clearly. I remove the 'inStatus=Status' in parameter passing but the error occurs:
    'Edit report 'sp_DBR_INV_edit_status' requires parameter 'inStatus', which was not supplied. Column 0 will not be editable'.

    You have a editing procedure which updates the (invoice?) status based on the code. The field to be updated is the Status field. When you attach a editing procedure to the Status field, the result of that user update selection is already automatically added to your updating procedure. You have added it twice: the automatic one and with the "inStatus=Status". It is hard to imagine that passing along the Status field as it is ('dbr.purehtml:<img....") would serve any purpose in the updating report, therefore we suggested that you can leave it out.

    I saw the error has been fixed in the latest build (v4.3.0, build 2489).

    The newest build include some improvements to the editable. For example you can now pass back HTML from the editing procedure by using 'dbr.html:'. For example in your case you can leave out the callback function and return the image directly from the editing report.

    --
    myDBR Team

  6. spyhunter88, Member

    Yes, I see the Status field pass the 'dbr.purehtml<img ....' along while I use 'inStatus=Status'. And the automatic parameter inLogin receives the value I need (NORMAL, TRACKING ...).
    So what is the automatic parameter to receive the real value while I can not leave the 'inStatus=Status' out?
    I tried to add a new inValue parameter with optional but cause "requires parameter" error? Like this:

    sp_DBR_INV_edit_status(inTaxCode varchar(30), inCustCode varchar(30), inCustName varchar(100), inStatus varchar(20), inValue varchar(50), inLogin varchar(50))

    Thanks,

  7. myDBR Team, Key Master

    As said, you do not need to pass along the edited cell (Status) as this is automatically added as last parameter.

    If your editable command is:

    select 'dbr.editable', '[Status]', 'sp_DBR_INV_edit_status', 'inItemCode=Item_Code', 'inItemName=Item_Name', 'type=select', "select=select 'NORMAL' UNION select 'TRACKING' UNION select 'ALERT'";

    then your editing procedure could have these parameters:

    sp_DBR_INV_edit_status(
    inItemCode varchar(30),
    inItemName varchar(30),
    inLogin varchar(50),
    inUserValue varchar(50)
    )

    The inLogin is an automatic variable and the the inUserValue will contain the value of the user selected Status-value. The values you do need to pass are the columns identifying the row to be updated.

    In your own example you do not need to pass inCustName if inCustCode already identifies the row.

    You do not need to use the callback either as the editing procedure can return the image HTML directly using 'dbr.html:'.

    --
    myDBR Team

  8. spyhunter88, Member

    Nice, I tried the inUserValue but I put it before inLogin parameter and does not work, but the last position make it work.

    And for the callback, I'll try later after the demo.

    Many Thanks,


Reply

You must log in to post.