dbr.editable multiselect type

(7 posts) (2 voices)
  1. eugfri, Member

    Hi,

    I have seen similar questions asked before but didn't see the answer I may re-use, hence, have to ask again.
    Like in this demo example when multi-select is used as report parameter:
    Demo MultiSelect param, I would like to use the same for my 'dbr.editable' column on the report.

    Unfortunately, dbr.editable does not provide "type" to enable display of multiple check-boxes which allow user to select more than one of them and "pack" checked values into delimited varchar variable for storing in the table column.
    I.e. 'textarea', 'autosize' (autosizing textarea), 'select', 'select_find', 'radiobutton', 'datepicker', 'datetimepicker', 'timepicker', 'colorpicker', 'richtext' are all possible "types" of dbr.editable.

    Is there any way for me to implement "milti-select" checkboxes?
    I don't know if this can be considered request for improvement, probably since dbr.editable already allows type=radiobutton, having milti-select checkboxes as new type would not be too much trouble to ask for?

    Ideally, if selected checkbox values can be packed into comma delimited variable it would be super useful!

    Thank you

    Eugene

    Posted 2 weeks ago #
  2. myDBR Team, Key Master

    It is more of an usability issue. A editable cell usually contains just one value (so that user can see it) so getting the initial values for the checkboxes is bit of an issue, the actual checkboxes with the comma delimited result would be the simpler part.

    --
    myDBR Team

    Posted 2 weeks ago #
  3. eugfri, Member

    Initial values for checkboxes can be set same way as for radio buttons or like for dropdown list - with sql statement.
    Also, I would like the editable cell to contain comma delimited list of values.

    I am sorry, are you saying it is possible to implement this as new feature for dbr.editable?
    I understand the possible complexity - say, if initial value of the column is A,B,D and checkboxes possible values are A,B,C,D,E,F - are you concerned about the need to mark checkboxes A, B and D as selected?
    I think this would be highly optional. If user decides to edit the column, the multi-select does not need to reflect the current value of the column as selected checkboxes.

    Posted 2 weeks ago #
  4. myDBR Team, Key Master

    It is possible to implement it, just that the usability is a concern. Let's give an example. Let's say the editing would choose cities, id's and the visble values being:

    • 1, London
    • 2, Paris
    • 3, Berlin

    The initial values are London and Paris. How to show that and produce that into a single cell (preferably using pure SQL)? As said, the actual editing part would be simple.

    --
    myDBR Team

    Posted 2 weeks ago #
  5. eugfri, Member

    So with your example:
    say, column has initial value of "London,Berlin". User clicks on it and it goes into editing mode.
    i.e. we have:
    select 'dbr.editable', [city], 'myproc', type="multi-select", "select=select 'London' as city union select 'Paris' as city union select 'Berlin' as city"

    When switched into editing mode, there will be 3 checkboxes displayed, one for each city. I would not even worry about showing "London" and "Berlin" checkboxes as checked to reflect correct initial values. It is not important.
    You can just mention in docs that using "multi-select" with dbr.editable does not preserve initial value of the column. Whatever checkboxes user marks - will simply overwrite what is in the column.
    I understand this would be problematic from usability standpoint for large sets, but for small sets it would be perfectly ok.

    Posted 2 weeks ago #
  6. myDBR Team, Key Master

    We've added 'checkbox'-type to the dbr.editable. See demo.

    You can also use dbr.report for this. The difference being that the checkboxes would be asked in a popup window and you would have the ability for decide the formatting (apart from list / rows automatically done with dbr.editable). With dbr.report you would use 'callbefore'-option to save the cell being clicked and then return JavaScript, which would put the data into the cell.

    A quick example with dbr.report:

    The main report:

    create procedure sp_DBR_cities
    as
    begin select 'dbr.javascript','function city_callbefore(cell) { window.mydbr_selected_cell = cell; return true; }' select 'dbr.report', 'sp_DBR_city_edit', '[cities]', 'dummy[]', 'event=click', 'in_cities<=ids', 'callbefore=city_callbefore'
    select 'Value', 'London,Paris' as 'cities', '1,2' as 'ids' end

    The sp_DBR_city_edit report's in_cities-parameter would be a checkbox and the report would then return result into the cell using JavaScript:

    create procedure sp_DBR_city_edit
    @in_cities varchar(30)
    as
    begin -- Do whatever needed.. -- Return the data
    select 'dbr.javascript', '$(mydbr_selected_cell).text("London,Berlin")' end

    --
    myDBR Team

    Posted 2 weeks ago #
  7. eugfri, Member

    This new feature is enourmous help and i thank you very much for the excellent work you do!

    Posted 1 week ago #

Reply

You must log in to post.