Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Display Multiple grids on same page in MVC
13/05/2011
21:44
Avatar
vitormaster
portugal
Member
Members
Forum Posts: 4
Member Since:
13/05/2011
sp_UserOfflineSmall Offline

Hi erveryone

I try to display two jqgrid on same page in a diferent div's, the grids are using different URL to load data, but only the first grid is show on the page. I asking if is possible do this!? 

Anyone can help 

Thanks in advance

16/05/2011
02:26
Avatar
vitormaster
portugal
Member
Members
Forum Posts: 4
Member Since:
13/05/2011
sp_UserOfflineSmall Offline

I asking if anyone to this before. Somebody told me that the problem my be in the same ids on the two grid. I post my code below :

("#listaAssistentesTODO").jqGrid({
                url: '/Medico/LoadToDoAssistentes/',
                datatype: 'json',
                mtype: 'GET',
                colNames: ['Cod.', 'Titulo', 'Assistente', 'Estado', 'Ultima Actualização'],
                colModel: [
                              { name: 'CodRelatorio', index: 'CodRelatorio', width: 50, align: 'center', hidden: true, sortable: false },
                              { name: 'TituloRelatorio', index: 'TituloRelatorio', width: 100, align: 'center', sortable: true },
                              { name: 'Assistente', index: 'Assistente', width: 100, align: 'center', sortable: false },
                              { name: 'EstadoRelatorio', index: 'EstadoRelatorio', width: 100, align: 'left', sortable: false },
                              { name: 'DataUltimaActualizao', index: 'DataUltimaActualizao', width: 100, align: 'left', hidden: false, sortable: false }
                 ],
                pager: jQuery('#page2'),
                rowNum: 50,
                rowList: [50],
                sortname: 'CodRelatorio',
                sortorder: "asc",
                viewrecords: true,
                imgpath: '/scripts/themes/steel/images',
                caption: 'Tarefas Pendentes Assistentes',
                onSelectRow: function (id) {

                    var data = $("#listaAssistentesTODO").getRowData(id);
                    alert("select row " + data.CodRelatorio);

                },
                loadComplete: function (data) {
                    alert("Load Complete");
                     //$('#list').setGridParam({ url: '/PesquisarRelatorios/GetGridData/' });
                },
                gridComplete: function () { alert("Grid Complet"); },
                beforeRequest: function () { },
                viewrecords: true,
                autowidth: true,
                autoheight: true
            }).navGrid(pager, { edit: false, add: true, del: true, refresh: true, search: false });

2º Grid

jQuery("#listMedicosTODO").jqGrid({
                url: '/Medico/LoadToDoMedicos/',
                datatype: 'json',
                mtype: 'GET',
                colNames: ['Cod.', 'Titulo', 'Estado', 'Ultima Actualização'],
                colModel: [
                              { name: 'CodRelatorio', index: 'CodRelatorio', width: 50, align: 'center', hidden: true, sortable: false },
                              { name: 'TituloRelatorio', index: 'TituloRelatorio', width: 100, align: 'center', sortable: true },
                              { name: 'EstadoRelatorio', index: 'EstadoRelatorio', width: 100, align: 'left', sortable: false },
                              { name: 'DataUltimaActualizao', index: 'DataUltimaActualizao', width: 100, align: 'left', hidden: false, sortable: false }
                 ],
                pager: jQuery('#pager1'),
                rowNum: 50,
                rowList: [50],
                sortname: 'Id',
                sortorder: "asc",
                viewrecords: true,
                imgpath: '/scripts/themes/steel/images',
                caption: 'Tarefas Pendentes Médicos',
                onSelectRow: function (id) {

                    var data = $("#listMedicosTODO").getRowData(id);
                    alert("select row " + data.CodRelatorio);

                },
                loadComplete: function (data) {
                    alert("Load Complete");
                    //$('#list').setGridParam({ url: '/PesquisarRelatorios/GetGridData/' });
                },
                gridComplete: function () { alert("Grid Complete"); },
                beforeRequest: function () { },
                viewrecords: true,
                autowidth: true,
                autoheight: true
            }).navGrid(pager, { edit: false, add: true, del: true, refresh: true, search: false });


And the server side controllers :

int pageIndex = Convert.ToInt32(page) - 1;
    int pageSize = rows;
    int totalRecords =  list.Count ;
    var totalPages = (int)Math.Ceiling(totalRecords / (float)pageSize);

    var jsonData = new
                       {
                           total = totalPages,
                           page,
                           records = totalRecords,
                           rows = (from item in list
                                   select new
                                              {
                                                  i ="a" + item.CodRelatorio,
                                                  cell = new[]
                                                             {
                                                                item.CodRelatorio ,
                                                                item.TituloRelatorio,
                                                                item.Assistente ,
                                                                "Em Elaboração",
                                                                item.DataUltimaActualizao
                                                             }

                                             }).ToArray()
                        };


    return Json(jsonData,JsonRequestBehavior.AllowGet);


If anyone try do to this please show me the sample of the code, to see what I doing wrong!!

16/05/2011
11:32
Avatar
vitormaster
portugal
Member
Members
Forum Posts: 4
Member Since:
13/05/2011
sp_UserOfflineSmall Offline

Nobody can help in this problem, I've change the id from the two grid like 'a123' and 'b123' to avoid id conflict. And the problem wat not solved:

onSelectRow: function (id) { alert(' id' + id);}

16/05/2011
11:32
Avatar
vitormaster
portugal
Member
Members
Forum Posts: 4
Member Since:
13/05/2011
sp_UserOfflineSmall Offline

Nobody can help in this problem, I've change the id from the two grid like 'a123' and 'b123' to avoid id conflict. And the problem wat not solved:

onSelectRow: function (id) { alert(' id' + id);}

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
62 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information