Im looking for an example of using an Inline Select...
Im looking for an example of using an Inline Select...
I've got the Grid view and Editor working well for regular inline edits, but I cant seem to figure out the trick for supporting the Select.
so far, when I click the td, the dropdown appears, and I can pick one, but there doesn't seem to be an event for grabbing that change.
Im assuming I need something taylored to be similar to this, but just for my select columns?
$('#report_data_tbl').on( 'click', 'tbody td', function (e) {
$editor.inline( this )
});
This question has an accepted answers - jump to answer
Answers
By default, inputs submit fine, but Selects do not. I did get Selects to submit with submitOnBlur works on the selects, but I was hoping to use Return to initiate the submits, and blur as a cancel, for both tyoes... is there an easy way to split that out?
you could give them all a similar class name:
Hmm, ok. I'll tinker with it and some more and see whats going to work. Thanks for the idea.
Hi,
Editor has a built in function that it uses to determine if a return key press should be used as a submit command or not. It will match all
input
element types, but it doesn't currently match onselect
elements.The problem with doing a return on select is that there doesn't appear to be any way to distinguish between a return key press to select a value in the list via keyboard, and a return when the element is just focused.
That is the reason why Editor doesn't doing submitOnReturn for the select lists. If there is a way to distinguish between the two states, then I think this would be a great addition.
Allan
ok, That makes sense. To speed dev up, I think I'll just switch it to one of the popup forms and perhaps I can do what I want to with bubble,and if not, then primary. Im assuming I can find a way to click on the row, and it pop up the primary form window, vs having to click the Edit button...
You could try bubble editing perhaps? Or inline with a submit button?
Allan
how do I use inline editing without a submit button on text fields and inline editign with a button for select fields?
// Select all elements with a
data-editor-field
attribute$('*[data-editor-field]').on( 'click', function () {
editor.inline( this );
} );
$('#training').on( 'click', 'tbody td', function () {
editor.inline( this );
} );
are in my code - but how do I use button with ONLY select fields?
$('#training').on( 'click', 'tbody td', function () {
editor.inline( this, {
buttons: { label: '>', fn: function () { this.submit(); } }
} );
You need to call
inline()
as appropriate, using the code you have above. You would need anif
statement that would decide (based on column index perhaps?) if the submit button should be shown or not.Allan