Bonjour tout le monde,
Je développe un site en MVC3 et techno microsoft framework 4.0.
J'ai insérer correctement ma grille dans ma page et tout est "ok" (données, trie).
Le problème vient de la pagination, quand je clique aucun appel ajax est réalisé.
Je cherche désesperemment d'ou cela peut venir. J'avais fais un test sur un projet et cela fonctionné.
Je n'ai pas d'erreur sur ma page.
Auriez vous une piste? je vous met mon code :
View:
et coté div :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 <script type="text/javascript"> ... $("#listApp").flexigrid({ url: urlApp, dataType: 'json', colModel: [ { display: 'Nom', name: 'Name', width: '200', sortable: true, align: 'left' }, { display: 'Etat', name: 'Etat', width: '200', sortable: true, align: 'left' }, { display: 'Version', name: 'Version', width: '100', sortable: true, align: 'center' } ], searchitems: [ { display: 'Nom', name: 'Name', isdefault: true } ], sortname: 'Name', sortorder: 'asc', usepager: true, title: TitlegridApp, useRp: true, rp: 10, showTableToggleBtn: true, width: 'auto', height: 120, search: searchvalue, singleSelect: true }); ... </script>
<div id="selectService" style="display: none;">
<table id="listService" class="scroll" cellpadding="0" cellspacing="0"> </table>
</div>
Coté controlleur:
Voila merci de votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 public JsonResult SelectAppJquery() { try { int page = int.Parse(Request.Form["page"]); int rp = int.Parse(Request.Form["rp"]); string qtype = Request.Form["qtype"].ToString(); string query = Request.Form["query"].ToString(); string sortname = Request.Form["sortname"].ToString(); string sortorder = Request.Form["sortorder"].ToString(); string search = Request.Form["search"].ToString(); if (!string.IsNullOrEmpty(search)) { List<BusinessObject.Application> reqsltApp = new List<BusinessObject.Application>(); using (var DomusEntity = new BusinessObject.DOMUSEntities()) { var reqsplsearch = DomusEntity.GetSimpleSearch(search); var dico = reqsplsearch.FirstOrDefault(); ViewData["ST"] = dico.ST; ViewData["BAIE"] = dico.BAIE; ViewData["Application"] = dico.Application; ViewData["UH"] = dico.UH; reqsltApp = DomusEntity.Applications.Where(p => p.Name.Contains(search)).ToList(); } var Applist = reqsltApp.AsQueryable(); if (!string.IsNullOrEmpty(qtype) && !string.IsNullOrEmpty(query)) { switch (qtype) { default: break; case "Name": Applist = Applist.Where(s => s.Name.Contains(query)); break; } } if (!string.IsNullOrEmpty(sortname) && !string.IsNullOrEmpty(sortorder)) { Applist = Applist.OrderBy(sortname, (sortorder == "asc")); } Applist = Applist.Skip((page - 1) * rp).Take(rp); var result = new { page = page, total = Applist.Count(), rows = Applist.Select(App => new { id = App.id_application.ToString(), cell = new string[] { App.id_application.ToString(), App.Name, App.State, App.Criticity } }) }; return Json(result, JsonRequestBehavior.AllowGet); } } catch (Exception exc) { log.Error(exc.Message, exc); } return null; }
Partager