cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

MDK Object Table control Search doesn´t function for binding with Client Data

yyertuganov
Participant
0 Likes
2,448

Dear Experts:

I am using Object Table control to show the table from Client Data using binding TARGET -> STRING TARGET ->{#Page:Main/#ClientData/#Property:ListOrders}.

It shows the table contents in the Object Table, however it´s single field Search function doen´t work, meaning doesn´t filter as I type values.

This function seem to work ok with EntitySet Binding with OData.

Is it something restricted for this control if use Client Data as a binding? If so is there some workaround suggestions?

Many thanks,

Yergali

View Entire Topic
bill_froelich
Product and Topic Expert
Product and Topic Expert

Another option is to still use the standard object table search input but instead of directly binding to the #ClientData you can use a rule. The rule will normally just return the ClientData value but when a search term is input it will re-execute the rule and you can then implement your custom search logic inside the rule and return the filtered sub-set of values.

Here is an example rule where I have the target for my Object Table set to this rule and inside the rule when the user searches I am filtering my Products list (from the Sample service) on Name or Category Name.

/**
 * Describe this function...
 * @param {IClientAPI} context
 */
export default function GetStringTargetWithSearch(context) {
    let target = context.evaluateTargetPath('#Page:Main/#ClientData/#Property:ProductsList');
    let searchString = context.searchString;
    if (searchString) {
        let searchResult = target.filter(prod => { return prod.Name.includes(searchString) || prod.CategoryName.includes(searchString) });
        target = searchResult;
    }

    return target;
}