Drop Downs as a way to inline edit?

Drop Downs as a way to inline edit?

lesalgado47lesalgado47 Posts: 40Questions: 14Answers: 0

I am thinking of controlling how users change the the data on the database by limiting their value selection through a Dropdown of possible values. My current plan of attack includes putting the DOM element in the table and have jquery pull it in through the datasource. Then have some event listeners change the value in the database. This seems hackish. Is there a better way to do this?

This question has accepted answers - jump to:

Answers

  • lesalgado47lesalgado47 Posts: 40Questions: 14Answers: 0

    I just tried this method out -- it works partially so this is how I plan to adapt this method if there isn't a better method out there:
    Have the database hold DOM elements as part of row data. Only one column will hold the DOM elements and thus I will disable the column from being editable inline that way the user does not see the DOM in the inline. Then I will add event listeners that will change the data in the database when the DOM button is clicked. I have seen drop downs done in Jeditable so my question is if there is a built in way to do it with Editor?

  • allanallan Posts: 63,096Questions: 1Answers: 10,390 Site admin
    Answer ✓

    This example shows a select input type being used in the last column.

    In general, Editor's inline editing mode will simply insert the required field into the target cell - regardless of the field type. Obviously some aren't particularly suitable for inline editing such as the plug-in WYSIWYG input types, but it is still possible to do.

    Allan

  • lesalgado47lesalgado47 Posts: 40Questions: 14Answers: 0

    From the example you pointed out, is this the piece of code that gets the dropdown?
    --type: "select" -- Additionally how could I customize this dropdown?

    I currently have DOM elements coming in to my table and I have CSS making it have its on hover action and custom color classes which change when the value in the cell changes.

    How can I extend --type: "select" -- to do the actions I am wanting?

  • allanallan Posts: 63,096Questions: 1Answers: 10,390 Site admin
    Answer ✓

    Yes - the fields.type option tells Editor what the field type should be. The fields.type documentation contains full details of this option.

    Additionally how could I customize this dropdown?

    In what way do you wish to customise it? Different options? There are a number of ways to set the options:

    • Using the options option for select
    • Using the options parameter in the returned JSON
    • Using the update method of the select field type.

    Allan

  • lesalgado47lesalgado47 Posts: 40Questions: 14Answers: 0
    edited May 2016

    I want to show a drop down menu that has different values [type: "select"] statement works well but I want to customize it a little. Instead of clicking for the drop down, I want it to show up onHover, how can I do that?

  • allanallan Posts: 63,096Questions: 1Answers: 10,390 Site admin

    how can I do that?

    As far as I am aware there is no option for that with an HTML select element. A quick Google search found this SO thread for example.

    Allan

This discussion has been closed.