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,444

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

Accepted Solutions (1)

Accepted Solutions (1)

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;
}

Answers (2)

Answers (2)

mingkho
Product and Topic Expert
Product and Topic Expert

Hi Yergali

Yes, Search functionality only works for binding with EntitySet, that's why it's not working with Target Path binding with #ClientData.

A possible workaround will be implementing your own search input (e.g. using Simple Property Form Cell) + custom search logic inside OnValueChange to update your ClientData with filtered data and then redraw the Object Table Section.

Regards

Ming

yyertuganov
Participant
0 Likes

Thanks a lot Ming, will try this method!

sopizaken
Participant
0 Likes

Hi ming.kho,

My list is binded to an entity set with a defined rule for a query option, and the filter does not work. Do you know the possible cause for this? What can be done to solve this issue?

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Likes

Rachel, Since this question os already answered, please open a new question with the specifics of issue.

yyertuganov
Participant
0 Likes

Thanks a lot Bill, will try this method as well!