Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update inlineedit.js #1664

Closed
wants to merge 5 commits into from
Closed

Update inlineedit.js #1664

wants to merge 5 commits into from

Conversation

bauer-git
Copy link

I have worked at getting the Inline Edit list plugin to work much more like a spreadsheet (as advertised).
Details of these changes...

If not in Edit mode...

If any element/cell is clicked, then that cell gains focus and is put in edit mode.

Pressing the Spacebar or Enter Key will put that element/cell in edit mode.

If Up/Down arrow keys are pressed, the element/cell above or below receives focus. 

If the Tab or Right Arrow key is pressed, the focus is moved to the next element/cell (left-to-right) UNLESS the column is the last editable column - in which case the focus moves down to the first editable column in the next row below.

If the Left Arrow key is pressed, the focus is moved to the previous element/cell (right-to-left) UNLESS the column is the first editable column - in which case the focus moves up to the last editable column in the previous row above. 

If in edit mode (and 'save on tab' is set)...

Clicking another editable element/cell saves the current edit and moves the focus to the newly selected element in edit mode.

If Up/Down arrows are pressed, the value is saved and the element/cell above or below receives focus. 

If the Tab Key is pressed OR the Enter key is pressed (and not a textarea element), the value is saved and focus moves to the next editable element/cell - unless it is already the last editable element in the row, in which case the focus moves to the first editable element in the next row below.

*** I used css to change the text color of all editable columns, in order to distinguish them from non-editable columns. I'm not sure if you'd want that as an option/parameter in the xml for the plugin itself, but I think it would be a good idea. E.g. 'Editable columns color:"

I have worked at getting the Inline Edit list plugin to work much more like a spreadsheet (as advertised).
Details of these changes...

If not in Edit mode...

	If any element/cell is clicked, then that cell gains focus and is put in edit mode.

	Pressing the Spacebar or Enter Key will put that element/cell in edit mode.

	If Up/Down arrow keys are pressed, the element/cell above or below receives focus. 

	If the Tab or Right Arrow key is pressed, the focus is moved to the next element/cell (left-to-right) UNLESS the column is the last editable column - in which case the focus moves down to the first editable column in the next row below.
	
	If the Left Arrow key is pressed, the focus is moved to the previous element/cell (right-to-left) UNLESS the column is the first editable column - in which case the focus moves up to the last editable column in the previous row above. 

If in edit mode (and 'save on tab' is set)

	Clicking another editable element/cell saves the current edit and moves the focus to the newly selected element in edit mode.

	If Up/Down arrows are pressed, the value is saved and the element/cell above or below receives focus. 
	
	If the Tab Key is pressed OR the Enter key is pressed (and not a textarea element), the value is saved and focus moves to the next editable element/cell - unless it is already the last editable element in the row, in which case the focus moves to the first editable element in the next row below.
	
*** I used css to change the text color of all editable columns, in order to distinguish them from non-editable columns. I'm not sure if you'd want that as an option/parameter in the xml for the plugin itself, but I think it would be a good idea. E.g. 'Editable columns color:"
@@ -80,9 +81,25 @@ var FbListInlineEdit = new Class({

// Click outside list clears down selection
window.addEvent('click', function (e) {
if(typeof this.activeElement !== 'null') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong most likely it should be:
if (this.activeElement !== null)
as typof(null) === 'object'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

The use of mootools typeOf was because of the ambiguity with javascript typeof (would always return 'object')
I overlooked this possibility earlier. Fix so that if clicking the same cell that is already in edit mode - it won't save this.activeElement (because that already IS this.activeElement).
if (activeClasses[0] == e.target.id){
return;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I overlooked this. Need to check if current element already is this.activeElement (if so no need to save anything - just ignore click and return)

var activeClasses = activeClassName.split(" ");
if (activeClasses[0] == e.target.id){
return;
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this check inside the if - else it would cause error when clicking outside the table as this.activeElement was undefined.

@bauer-git bauer-git closed this Feb 7, 2018
@bauer-git bauer-git deleted the patch-12 branch February 7, 2018 00:09
@Sophist-UK
Copy link

Why did you close this. I know it's old, but if it still works we should ask Hugh to merge it - if Fabrikar isn't supporting inlineedit, then Hugh should perhaps merge this without testing on the basis that it is community supported instead.

@bauer-git
Copy link
Author

Before closing I tried using it a bit only to realize it's not working with the current php code.
I've heard it from Hugh numerous times that they intend to trash the plugin and no longer support it. So why bother?

I have a modified list template that I use . It works just like a spreadsheet 'form' in tables that have thousands of records filtered to the userid with hundreds of rows and over a dozen columns. Works like a charm,

Right now it's too customized (to this project) to be used by the community - but maybe one day I'll take a crack at it.

@Sophist-UK
Copy link

Hugh does not have the time to support it. So it either needs to be community supported or it will be trashed (which would be a pity - I have used it in the past and it was great).

However, that said, an alternative way of achieving it might be to create a Visualization to do it instead.

I am working on a completely different Visualization at the moment, but I can see that it would not be that hard to create a spreadsheet like editing of a list using a Visualization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants