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

Added better configuration of buttons in 'control' field. #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/fields/jsgrid.field.control.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
deleteButton: true,
clearFilterButton: true,
modeSwitchButton: true,
searchButton: true,
insertButton: true,

_initConfig: function() {
this._hasFiltering = this._grid.filtering;
Expand Down Expand Up @@ -91,16 +93,16 @@
},

filterTemplate: function() {
var $result = this._createSearchButton();
var $result = this.searchButton ? this._createSearchButton() : $("");
Copy link
Owner

@tabalinas tabalinas Jun 17, 2016

Choose a reason for hiding this comment

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

The initial idea behind was: If user needs filtering, he probably needs the search button. If he doesn't need filtering, he can turn it off with the filtering option.
Do you have scenario when you need to hide search button? And what is about the button to clear filter? Is it stays visible on purpose?

return this.clearFilterButton ? $result.add(this._createClearFilterButton()) : $result;
},

insertTemplate: function() {
return this._createInsertButton();
return this.insertButton ? this._createInsertButton() : $("");
Copy link
Owner

Choose a reason for hiding this comment

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

For insert button (the same as for update button): how user can insert an item without this button?
If we doesn't need inserting, he can turn it off with inserting option.

},

editTemplate: function() {
return this._createUpdateButton().add(this._createCancelEditButton());
return this.editButton ? this._createUpdateButton().add(this._createCancelEditButton()) : $("");
Copy link
Owner

Choose a reason for hiding this comment

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

Not sure, why do we need to hide update & cancel button for edit row?
Initial idea was hiding edit button, but still being able to edit a row (e.g. with row click). And to complete editing or cancel changed we need these buttons.

},

_createFilterSwitchButton: function() {
Expand Down