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

refactor(filters): name of filter input defined by the filter key rather... #523

Merged
merged 1 commit into from
Jan 25, 2015

Conversation

christianacca
Copy link
Collaborator

... than a separate $$name field

Now a filter input's name is set to the filter key. Eg:

Given: <td filter="{'username': 'text'}"</td>
Results in the filter input: <input name='username'/>

Previously:

  • Unless $$name was supplied, a filter input's name was incorrectly set to 'false'
  • When $$name was supplied, multiple filters defined by the same filter definition would share the same name

BREAKING CHANGE:

  • $$name field on filter definitions is not supported.

Previously:

<td filter="{'username': 'text', $$name: 'username'}"</td>

... now becomes:

<td filter="{'username': 'text'}"</td>
  • column.filterName has been dropped as this is no longer applicable. Custom filter templates will need to change.

Previously:

        <input type="text" name="{{column.filterName}}"

... now becomes:

        <input type="text" name="{{name}}"
  • Multiple filters defined by the same filter definition will now render each input with a seperate name.

…her than a separate $$name field

Now a filter input's name is set to the filter key. Eg:

Given: `<td filter="{'username': 'text'}"</td>`
Results in the filter input: `<input name='username'/>`

Previously:

* Unless $$name was supplied, a filter input's name was incorrectly set to 'false'
* When $$name was supplied, multiple filters defined by the *same* filter definition would share the same name

BREAKING CHANGE:

* $$name field on filter definitions is not supported.

Previously:

````
<td filter="{'username': 'text', $$name: 'username'}"</td>
````
... now becomes:

````
<td filter="{'username': 'text'}"</td>
````

* column.filterName has been dropped as this is no longer applicable. **Custom** filter templates will need to change.

Previously:

````
        <input type="text" name="{{column.filterName}}"
````
... now becomes:

````
        <input type="text" name="{{name}}"
````

* Multiple filters defined by the *same* filter definition will now render each input with a seperate name.
@christianacca
Copy link
Collaborator Author

Guys,

I'm introducing a breaking change here so want to make it more visible by creating a pull request.

I think my changes are justified. Here's ,my thought process...

I've spent time looking at how the original feature of allowing a name to be assigned to a filter input:

I strongly suspect that the original change was done quickly by copying some previous code - code that introduced the ability to specify the url to a filter template: #40

I don't think the code that was copied was a good design. I think that the url should have been the filter value rather than introduce a separate templateURL field. In fact I've committed a change that allows for just that: 7955f12

So rather than use the copy and paste code, I think a simpler and cleaner design is to use the filter key as the filter input name.

Hopefully the breaking changes I've made will only affect a very small set of developers - those using the this undocumented $$name field.

C

christianacca added a commit that referenced this pull request Jan 25, 2015
refactor(filters): name of filter input defined by the filter key rather...
@christianacca christianacca merged commit 2ea2b62 into master Jan 25, 2015
@christianacca christianacca deleted the filters-breaking-changes branch January 25, 2015 18:28
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

2 participants