Author Topic: "undefined" when no record in grid  (Read 3525 times)

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
"undefined" when no record in grid
« on: February 27, 2020, 03:39:06 am »
If I'm loading a grid based on search results, and there is no data returned from the search, the grid displays "undefined". Can I change the text to something like "No results available"?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: "undefined" when no record in grid
« Reply #1 on: February 27, 2020, 10:18:05 am »
Please include localization file from localize folder in SDK and you can modify that file to display your custom messages.

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Re: "undefined" when no record in grid
« Reply #2 on: February 27, 2020, 07:19:36 pm »
I've included the file, pq-localize-en.js, in my page. However, I don't see how I change it, since "undefined" is not listed anywhere in this file.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: "undefined" when no record in grid
« Reply #3 on: February 27, 2020, 08:03:51 pm »
There is no other reason to display "undefined".

Please share a jsfiddle so that it can be checked.
« Last Edit: February 27, 2020, 08:32:49 pm by paramvir »

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Re: "undefined" when no record in grid
« Reply #4 on: February 27, 2020, 08:46:17 pm »
How do I modify the file, pq-localize-en.js, to change the word "undefined" to "No search results returned"? I don't want to see "undefined" anything in the grid.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: "undefined" when no record in grid
« Reply #5 on: February 27, 2020, 08:59:08 pm »
Default entry is strNoRows:  "No rows to display." in pq-localize-en.js

Please ensure localization file is included in correct order: https://paramquery.com/pro/tutorial#topic-include

If you still see "undefined", then it means something is wrong in your code / configuration. Please share a jsfiddle so that it can be checked.
« Last Edit: February 27, 2020, 09:03:49 pm by paramvir »

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Re: "undefined" when no record in grid
« Reply #6 on: February 27, 2020, 09:24:48 pm »
If I'm not getting any data back, I don't want "undefined"

https://jsfiddle.net/mq2xavcz/2/

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: "undefined" when no record in grid
« Reply #7 on: February 27, 2020, 10:00:58 pm »
Please check the result after including localization file: https://jsfiddle.net/s546L0rp/