0

I'm planning on implementing jqGrid on a project that requires multiple languages. Can someone please confirm if jqGrid supports location with ASP .NET MVC by using the text from resource files? Any sample project would be very useful.

Thanks, Imran

A.K
  • 505
  • 1
  • 12
  • 30
  • jqGrid is JavaScript solution. It can't access text resources of ASP.NET directly. So you have to provide the information in another way. There are different interpretation what one mean under "localization". How you choose the language for example? Is it web browser language? Do you have some user to language mapping in your application? Do you know the user's language *before* you create jqGrid or you get the information after the first request for filling the grid and you want **to change** the language dynamically? I can continue with more questions... – Oleg Apr 22 '15 at 09:59
  • Thanks for the input @Oleg, there are two languages to support for the entire solution. So the users can chose to change language by clicking on on icon on top navigation for the whole site for instance. So basically we need two sets of texts for column headers and labels etc. The content from database remains the same. Can you point out an implementation so I can see how language is specified? – A.K Apr 22 '15 at 11:24

1 Answers1

1

You can use setLabel to change column headers and setCaption to set the title of the grid. You can need to call setColWidth method, autoResizeColumn or autoResizeAllColumns additionally to change the width of the column after changing the column headers.

Free jqGrid supports locale option. One can load multiple locale files at once. The default language displayed in grid will be the language of the last included locals file grid.locale-XX.js, but you can use locale option (like locale: "en-US" for example to specify another locale). See the wiki article for more information. There are exist currently no method which would refresh the texts of the pager if locale option will be changed dynamically.

I recommend you to read the old answer, this one and this one which shows some ideas which can you use in your solution.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798