asp.net mvc - 2 gijco grid in a same view -
i have problem gijco grid in case.
i have 2 grids in same view (asp.net mvc).
if have pager in first grid , not in second, second grid doesn't load tha data... if uncomment pager on second grid (with same condition) data loaded (see code).
source
$(document).ready(function () { datasourceiniziale = @html.raw(json.encode(model.psa)); dsistruttori = @html.raw(json.encode(model.istruttori)); $("#hdatasource").val(json.stringify(@html.raw(json.encode(model.psa)))); grid = $("#gridpsa").grid({ pager: { enable: true, limit: 10, sizes: [10, 20, 50, 100] }, datasource: datasourceiniziale, selectionmethod: 'checkbox', selectiontype: 'multiple', detailtemplate: '<div class="panel-footer"><div class="alert alert-warning small"><span class="glyphicon glyphicon-info-sign"></span><br /><b>idpsaazienda:</b>{idpsaazienda}<br /><b>idtoken:</b>{idtoken}<br /><b>compilatore;</b>{compilatore}<br /><ul><li><b>compilatorecontatti:</b>{compilatorecontatti}</li></div></div>', datakey: "id", uilibrary: "bootstrap", columns: [ { field: "id", sortable: false, hidden: true }, { field: "idpsaazienda", sortable: false, hidden: true }, { field: "idtoken", sortable: false, hidden: true }, { field: "compilatore", sortable: false, hidden: true }, { field: "compilatorecontatti", sortable: false, hidden: true }, { field: "ragionesociale", sortable: false, title: "ragione sociale" }, { field: "comune", sortable: false, title: "comune" } //, //{ width: 34, type: "icon", icon: "glyphicon-pencil", tooltip: "modifica", events: { "click": edit } }, //{ width: 34, type: "icon", icon: "glyphicon-remove", tooltip: "elimina", events: { "click": delete } } ] }); gridistruttori = $("#gridistruttori").grid({ datasource: dsistruttori, //pager: { enable: false, limit: 10, sizes: [10, 20, 50, 100] }, selectionmethod: 'checkbox', selectiontype: 'multiple', detailtemplate: '<div class="panel-footer"><div class="alert alert-warning small"><span class="glyphicon glyphicon-info-sign"></span><br /><b>idutente:</b>{idutente}<br /><b>username:</b>{username}<br /></div></div>', datakey: "id", uilibrary: "bootstrap", columns: [ { field: "idutente", sortable: false, hidden: true }, { field: "cognome", sortable: false}, { field: "nome", sortable: false }, { field: "username", sortable: false, title: "username", hidden: true } ] }); });
where error? exist workaround situation? thanks.
this bug in version 0.6.
example workaround issue.
<table id="grid1"></table> <table id="grid2"></table> <script> var data1 = [ { 'id': 1, 'name': 'hristo stoichkov', 'placeofbirth': 'plovdiv, bulgaria' }, { 'id': 2, 'name': 'ronaldo luis nazario de lima', 'placeofbirth': 'rio de janeiro, brazil' }, { 'id': 3, 'name': 'david platt', 'placeofbirth': 'chadderton, lancashire, england' } ]; var data2 = [ { 'id': 1, 'name': 'hristo stoichkov', 'placeofbirth': 'plovdiv, bulgaria' }, { 'id': 2, 'name': 'ronaldo luis nazario de lima', 'placeofbirth': 'rio de janeiro, brazil' }, { 'id': 3, 'name': 'david platt', 'placeofbirth': 'chadderton, lancashire, england' } ]; $('#grid1').grid({ datasource: data1, uilibrary: 'bootstrap', columns: [ { field: 'id' }, { field: 'name' }, { field: 'placeofbirth' } ], pager: { limit: 2, sizes: [2, 5, 10, 20] } }); gj.grid.methods.getrecordsforrendering = function ($grid) { return $grid.data('records'); }; $('#grid2').grid({ datasource: data2, uilibrary: 'bootstrap', columns: [ { field: 'id' }, { field: 'name' }, { field: 'placeofbirth' } ] }); </script>
this fixed in version 1.0 , above recommend upgrade new version http://gijgo.com
Comments
Post a Comment