This is a migrated thread and some comments may be shown as answers.

[Solved] Removing NaN from an empty grid

7 Answers 183 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
critto
Top achievements
Rank 1
critto asked on 21 May 2010, 12:05 PM
Hi everyone. I have this text appearing in the status row of my Grid controls when they are empty:

Displaying items 1 - NaN of undefined

Is there a default I can set for no records?

Cheers!

Hamish.

7 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 21 May 2010, 01:10 PM
Hello critto,

Which version are you using? This sounds like an old bug which is already fixed. You can try the build attached to this forum thread.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Teseo
Top achievements
Rank 1
answered on 21 Jul 2011, 01:57 PM
With the last release (Q2 2011 - version 2011.2.712.0) I get a similar error:

'Rows 0 - Nan of '

Is it a known issue?
Thanks for your help.
0
Atanas Korchev
Telerik team
answered on 21 Jul 2011, 02:07 PM
Hello Teseo,

 Please check this forum thread.

Greetings,
Atanas Korchev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Teseo
Top achievements
Rank 1
answered on 21 Jul 2011, 02:13 PM
Thank you very much, it worked.

Best regards.
0
JorgeMuza
Top achievements
Rank 1
answered on 19 Aug 2011, 07:50 PM
For those interested in know what exactly was changed, to fix the error described above, take a look into the before and after of the following code snippets within telerik.grid.js around line 723:

Before:

total: function (data) {
    if (data) {
        data = this.convert(data);
        return !$.isArray(data) ? data.total || data.Total : data.length;
    }
    return 0;
},
After:

total: function (data) {
    if (data) {
        data = this.convert(data);
        return !$.isArray(data) ? data.total || data.Total || 0 : data.length;
    }
    return 0;
},
0
Micah
Top achievements
Rank 1
answered on 31 Aug 2011, 12:21 AM

The updated code didn't work for me so I implemented a quick jQuery hack on the Grids "OnDataBound" event that you can assign a client side handler to:

 

function onDataBound(e) {
        // HACK to fix telerik grid issue displaying NaN
        $('div.t-status-text').each(function () {
            if ($(this).text() == 'Displaying items 0 - NaN of undefined') {
                $(this).text('Displaying items 0 - 0 of 0');
            }
        });
    }

 

 

 

0
Hardeep
Top achievements
Rank 1
answered on 12 Nov 2012, 03:19 PM
Hello Micah,

You make my day. I searched for this topic for many days. Its working fine for me. 

Once again thanks for this

Thanks
Hardeep Singh

Tags
Grid
Asked by
critto
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Teseo
Top achievements
Rank 1
JorgeMuza
Top achievements
Rank 1
Micah
Top achievements
Rank 1
Hardeep
Top achievements
Rank 1
Share this question
or