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

REST Service Calls with grid client binding

4 Answers 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris Messineo
Top achievements
Rank 1
Chris Messineo asked on 17 Nov 2008, 07:52 PM
I checked out the tutorial at this url:  http://blogs.telerik.com/VladimirEnchev/Posts/08-11-12/REST_Service_Calls_with_grid_client_binding.aspx?ReturnURL=%2fVladimirEnchev%2fPosts.aspx

Nice article, one question though, if I get zero hits and use the set_virtualItemCount(0) the grid does not show that there are zero hits, do I maybey need to call an update or refresh method on the grid?

Thanks

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 21 Nov 2008, 08:46 AM
Hello Chris,

Generally if you return empty collection the grid should handle this automatically. I notice unfortunately that NoRecordsTemplate/NoMasterRecordsText does not work properly in this case and we have fixed this immediately. The fix will be available next week with our service pack.

Best wishes,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chris Messineo
Top achievements
Rank 1
answered on 21 Nov 2008, 02:31 PM
Thanks for looking into this. 

Kind of a hack but I just manipulated the Table in javascript to show no results:

Something like:

                    var myTable = document.getElementById("ctl00_ContentPlaceHolder1_RadGrid1_ctl00");
                    myTable.deleteRow(1);                   
                    myTable.deleteTFoot();                                                           

                    var newrow = myTable.insertRow(1) //add new row to end of table
                   
                    newrow.height = "30";
                    var newcell_0 = newrow.insertCell(0) //insert new cell to row
                    newcell_0.align = "right";
                    newcell_0.innerHTML = "<b>No&nbsp;</b>";

                    var newcell_1 = newrow.insertCell(1);
                    newcell_1.innerHTML = "<b>records found.</b>";

0
Chris Messineo
Top achievements
Rank 1
answered on 08 Dec 2008, 05:59 PM

Hi Vlad,

I downloaded the latest service pack and I still can't get the grid to show zero hits, I am using your exmple.

 

Thanks

Chris

0
Nikolay Rusev
Telerik team
answered on 09 Dec 2008, 04:37 PM
Hello Chris,

You can use the following code to hide grid data items if there are no records to display.

/listen for OnDataBound client event/
<ClientEvents OnDataBound="Grid_DataBound" /> 

/code for the handler/
    <script type="text/javascript">  
        function Grid_DataBound(sender, args)  
        {              
            if ($telerik.$(".rgNoRecords", sender.get_masterTableView().get_element())  
                    .css("display") != "none")  
            {                  
                $telerik.$(".GridRow_Office2007", sender.get_masterTableView().get_element())  
                    .css("display", "none");  
                $telerik.$(".GridAltRow_Office2007", sender.get_masterTableView().get_element())  
                    .css("display", "none");                  
            }  
        }  
    </script> 


Kind regards,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Chris Messineo
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Chris Messineo
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or