Localized column names (titles) and prefefined/saved searches

Localized column names (titles) and prefefined/saved searches

supermindsupermind Posts: 27Questions: 5Answers: 0

My application is localized and that also covers all column names (titles) in my tables. For example, one column is "Stock" in English and "Saldo" on Swedish.

When SearchBuilder criteria is saved, the "data" property has the column name (title) and "origData" property has the underlying database column name (because I'm using server side processing). However, "data" property is saved with localized name ("Stock") and when the criteria is loaded with different locale ("Saldo"), DataTable does not know what to do.

Why the "data" property is saved in the first place and why it's needed? Is there any workarounds?

This question has accepted answers - jump to:

Answers

  • sandysandy Posts: 913Questions: 0Answers: 236
    Answer ✓

    Hi @supermind ,

    Thanks for pointing this out. It's not something that we had considered when writing SearchBuilder, but I agree that it would be nice to handle this. I've raised an issue internally (DD-2386 for my reference) and will report back here when there is an update.

    Thanks,
    Sandy

  • sandysandy Posts: 913Questions: 0Answers: 236
    Answer ✓

    Hi @supermind ,

    I've added in functionality that should work for you. This will be available in the next SearchBuilder release which we hope will be in the next few weeks. Until then you can access the fix from the nightly builds.

    Thanks,
    Sandy

  • supermindsupermind Posts: 27Questions: 5Answers: 0

    Hi @sandy ,

    This is great! I'm so happy you've implemented a fix already. I cannot wait to test it next week.

    Thank you so much for this!

  • supermindsupermind Posts: 27Questions: 5Answers: 0

    Hi @sandy ,

    I downloaded the nightly build, but could not get it work.

    Here is screenshot of my localized Finnish searhbuilder where condition is 'Nimi' Sisältää (contains in English) 'pp', which then shows only one line which has value 'Pepper'.

    However, when I change the language to English when the column name changes to Name, the search builder looks like this:

    So the filter does not show 'Name' Contains 'pp' it should and the table shows all rows.

    SearchBuilder settings are in both situations:

              "searchBuilder": {
                    "criteria": [
                        {
                            "condition": "contains",
                            "data": "Nimi",
                            "origData": "item_name",
                            "type": "string",
                            "value": [
                                "pp"
                            ]
                        }
                    ],
                    "logic": "AND"
                }
    
  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Are you able to create a test case, please, it would help us to understand what's going on? Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • supermindsupermind Posts: 27Questions: 5Answers: 0

    Hi @colin,

    I tried to reproduce the error with live.datatables.net, but I could not. I think it's because my application is so complex I can't include all details there.

    I might be able to give instructions to you how you can reproduce this error in my own web app, but it is possible to send instructions and credentials privately?

    By the way, were there any changes in other libraries or was only SearchBuilder affected in your fix?

  • supermindsupermind Posts: 27Questions: 5Answers: 0

    Hi again! My bad. I included the nightly librady you provided, but at the same time I had old version of SearchBuilder code in my concatenated library. Everything works now just fine. Thank you so much for your help, have a great weekend and happy christmas holidays to all :smile:

    SpryMedia, thank you for maintaining this greate piece of code. DataTables and Editor plays key role in our application and we're very happy to use them!

  • supermindsupermind Posts: 27Questions: 5Answers: 0

    Hi again! Is this fixed in release v1.3.1?

    I could not find release notes for latest release in CDN (latest version at https://cdn.datatables.net/#SearchBuilder is 1.3.0).

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    We'll reply in the other thread you asked this question in,

    Colin

Sign In or Register to comment.