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

Different value and display text for select filter element #581

Closed
kerberosargos opened this issue Jun 11, 2019 · 5 comments
Closed

Different value and display text for select filter element #581

kerberosargos opened this issue Jun 11, 2019 · 5 comments
Assignees

Comments

@kerberosargos
Copy link

    ...
    <td data-filter="text-for-filter">Display Text</td>
    ...

Hello, my datatable td's html codes as above and my yadcf filter settings as below

    ...
    yadcf.init(Datatable,
                                [{
                                    column_number: 0,
                                    style_class: "custom-select",
                                   html5_data: "data-filter"
                                },
    ...

After rendered html, result as below

    ...
    <option value="bla-bla">bla-bla</option>
    ...

I would like to get result as below. is it possible?

    ...
    <option value="text-for-filter">Display Text</option>
    ...
@vedmack
Copy link
Owner

vedmack commented Jun 11, 2019

please provide a test page (jsfiddle)

@kerberosargos
Copy link
Author

Hello again,

I have created an example into jsfiddle https://jsfiddle.net/umtd07sj/1/

I would like to show select element as below

<select id="yadcf-filter--TableTypes-0" class="yadcf-filter " onchange="yadcf.doFilter(this, '-TableTypes', 0, 'contains');" onkeydown="yadcf.preventDefaultForEnter(event);" onmousedown="yadcf.stopPropagation(event);" onclick="yadcf.stopPropagation(event);">
	<option value="-1">Select Types</option>
	<option value="types-car">Cars</option>
	<option value="types-fruits">Fruits</option>
</select>

@vedmack vedmack self-assigned this Jun 11, 2019
vedmack added a commit that referenced this issue Jun 12, 2019
Added column_data_type: 'html5_data_complex' type to parse and populate value/display from datatable html5 attributes - #581
vedmack added a commit that referenced this issue Jun 12, 2019
Added column_data_type: 'html5_data_complex' type to parse and populate value/display from datatable html5 attributes - #581
@vedmack
Copy link
Owner

vedmack commented Jun 12, 2019

added in 0.9.4.beta.28 , see it working https://jsfiddle.net/vedmack/kq8avshw/

@vedmack vedmack closed this as completed Jun 12, 2019
@tanyona
Copy link

tanyona commented Nov 22, 2019

I see this will require use of html data attributes. Would it be possible for it to work with the datatables data option e.g. when using an ajax data source e.g.

columns: {
	"data": {
			_: "phone",
			filter: "phone_filter",
			display: "phone_display"
		}
	}

@vedmack
Copy link
Owner

vedmack commented Nov 24, 2019

@tanyona please open a new issue with jsfiddle test page and I will see what can be done

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

No branches or pull requests

3 participants