We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Change the "items" term in the grid.

Hi,

We will like to know if its possible to change the word "items" in the grid's Caption bar that follows the number of items the grid contains.
[...]
            .Datasource(Employees.List).Caption("Employees")
[...]
So instead of the caption being:   "Employees 24 items" we could display: "Employees 24 records"

In case this is not achievable, how do we remove this header?

Thanks,

Mijail

5 Replies

TH Thivya Syncfusion Team February 25, 2013 05:47 AM UTC

Hi Mijail,

Currently, we don’t have support for customizing the caption in the Grid header. If you want to do as per your requirement then you should use jQuery “pagebeforeshow” event to update the full caption as an workaround. Please refer the below code snippets.

$("div[data-role='page']").bind("pagebeforeshow", function () {

   var ele = $sf.getCurrentPage().find("#grid .sf-caption-row");

   ele.html(ele.html().replace("Items", "Records"));

});

Otherwise, you can make the “ShowCaption” property with false which we have provided to remove the header. Please do as in following code snippets.

[...]

            .Datasource(Employees.List).Caption("Employees").ShowCaption(false)

[...]

Please try this and get back to us if this helps out.

Regards,
Thivya.



MO Mijail O Tornes February 25, 2013 04:36 PM UTC

Hi Thivya,

Using the pagebeforeshow event works at page(view) level only. 
If there was a way to bind this replace script to the grid's creation/update triggers or functions?
Thanks,
Mijail 
  


TH Thivya Syncfusion Team February 26, 2013 10:24 AM UTC

Hi Mijail,

We have provided Load event for the Grid control so that you can use the script with “OnLoad” event. Please refer the following code snippets.

function load() {
        var ele = $sf.getCurrentPage().find("#grid .sf-caption-row");
        ele.html(ele.html().replace("Items", "Records"));
}

And handle the event in view page as follows..

[...]
      
.Events(e => e.OnLoad("load"))
[...]

Please let us know if you have any queries.

Regards,
Thivya.



MO Mijail O Tornes February 26, 2013 10:37 PM UTC

Hi,

Using the onLoad() function works fine but if the page is reloaded: (F5 by keyboard).
The grid puts back the "items" label.
Any suggestions for this issue?


TH Thivya Syncfusion Team February 27, 2013 12:55 PM UTC

Hi Mijail,

We are not able to reproduce the issue you mentioned that Grid push back the "items" label when reloading the page. For your reference we have attached sample hereby please go through the sample and get back to us if this helps out.
             

Regards,
Thivya.


Grid_f8a720e8.zip

Loader.
Live Chat Icon For mobile
Up arrow icon