I am working with a slickgrid cell that has an autocompletion feature and a custom formatter. The cell value is a key field in a list of dynamically loading autocompletion options. These options are displayed as labels (e.g.
Contract: ABCDEF-123, thick:10, width:210, City: Chicago
) and when one is selected, it appears in the corresponding input field. The issue arises because the formatter only recognizes the key (order_id) and not the label itself.
function contractFormatter(row, cell, value, columnDef, dataContext) {
var res = '';
var val = get_contract_list()[value] ? get_contract_list()[value]['label'] : '';
res = '<span class="' + getSpanClass() + '" style="float: left;"></span>\n\
'+ (val =='' ? '<span style="color:slategrey;"> Enter 3 symbols </span>' + val : val) + '';
return res;
}
The get_contract_list
function retrieves the entire list of contracts, which is quite large. As a result, the decision was made to make this list dynamic. Currently, the function is empty and it would be preferable to simply extract the selected label into the variable val
.
Is there a solution to achieve this?