-
Notifications
You must be signed in to change notification settings - Fork 284
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
Server-side scenario > Select2 dataArray > templateResult/-Selection icon #245
Comments
Hi, So eventualy you are asking for a way to feed yadcf select filter with your own string containing the list of |
Hi, I used select2 instead the normal select because HTML images weren´t shown respectively rendered. At this time my code for the adapted yadcf select2 ColumnDef looks like this: function getColumnImageDropDownDef(columnNumber) {
return {
column_number: columnNumber,
select_type: 'select2',
filter_default_label: '',
sort_as: 'numerically',
sort_order: 'asc',
select_type_options: {
width: '28px',
multiple: false,
escapeMarkup: function(m) {
return m;
},
createTag: function() { return null; },
allowClear: false,
templateResult: formatState,
templateSelection: formatState,
minimumResultsForSearch: -1
}
}
};
function formatState(state) {
if (!state.id) { return state.id; }
var path = window.rootUrl + 'res/images/status_' + state.id + '.png';
var $state = $('<span><img src="'+ path +'" style="width: 8px;" class="img-flag" /></span>');
return $state;
}; I tried to pass the static data array to the yadcf colDef and to the select_type_options, but that didn´t worked since the static data array of course came from server. They were rendered double or yadcf took its fallback to get the html from current datatable page only in server-side scenario (what is not sufficient) and the current selected option was always overruled by the default option value -1 injected by yadcf... Perhaps I overlooked something... |
… your own <option></option> for the filter #245
Added data_as_is attribute (in 0.8.9.beta.24) to use when you want to define your own for the filter,
|
Hi Daniel,
first, thanks for providing and supporting this plugin!
This is less an issue, than a feature request.
Background:
1.) I´am in server-side paged scenario using the 0.8.9.beta.21 version.
2.) I am disaplaying a bunch of records that got an status icon (red, blue, green ball).
3.) In order to save column width I decided to choose a Select2 filterdropdown reflecting 4 icons to filter from for the users (grey = all records, green = records in status green, red... and so forth)
To solve that, I had to do small changes to source. It could also be, that I missed something in usage. But for now, it solves my problem, but doesn´t propably play with all usages of the plugin.
In summary: This is perhaps a feature request to support Selet2´s static data Array using templating.
Best wishes
Orca11
The text was updated successfully, but these errors were encountered: