Code Monkey home page Code Monkey logo

Comments (2)

pietervogelaar avatar pietervogelaar commented on August 23, 2024

Isn't it possible to do the concatenate part in PHP code? You now the possibility that you can specifiy an anonymous function as the data key for a column? The database row is passed to it as the first argument. So there you can concatenate and return the value in the function.

from pike.

githendrik avatar githendrik commented on August 23, 2024

That was my initial idea as well. However for some reason my custom formatter is not accepted by Jqgrid.
Also, I think it would be more consistent to specify the fields to be concatenated in the select clause instead of writing and applying custom formatters for every occasion. It would also be a pain to have to hide all source fields of the concat after formatting.

EDIT: I had success formatting a field so that it represents a concatenation of 2 other fields. However, there are 3 shortcomings in this approach:

  1. The formatter needs the exact positions of the fields (row object is a regular array) to be concatenated
  2. The fields need to be hidden manually
  3. Filtering only works for the data that is in the field by default. In my example I used zip code and city. I have hidden the zip code field and added a custom formatter to the city. The formatter then uses the index of city and concatenates it with the prepended zip code (City-Index -1 in the row array). The problem here is that filtering only works for city, not for zip code.

from pike.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.