jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Default filter on refresh
Tagged: grid filter default refresh
This topic contains 2 replies, has 2 voices, and was last updated by Stanislav 7 years, 6 months ago.
-
Author
-
Hello, i’m setting a default filter on load a Grid (addfilter)but when I call function to refresh data (getActionItemsData) the default filter don’t work, this is my code:
function getActionItemsData() { $("#grillaActionItem").jqxGrid('clear'); var theme = 'arctic'; var imgStyle = 'style="position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;"'; var sourceA = { url: '<?php echo base_url(); ?>Proyectos/SeguimientoAvances/grillaActionItemsSeguimiento/', dataType: 'json', cache: false, async: false, datafields: [ { name: 'id_action_item', type: 'int' }, { name: 'id_proyecto', type: 'int' }, { name: 'titulo', type: 'string' }, { name: 'fecha_compromiso', type: "date", format: 'yyyy-MM-dd' }, { name: 'compromiso_original', type: "date", format: 'yyyy-MM-dd' }, { name: 'responsable', type: 'string' }, { name: 'usuario', type: 'string' }, { name: 'estado', type: 'int' }, { name: 'estado_txt', type: 'string' }, { name: 'impacto', type: 'string' }, { name: 'severidad', type: 'int' }, { name: 'reprogramaciones', type: 'int' }, { name: 'fecha_carga', type: "date", format: 'yyyy-MM-dd HH:mm:ss' }, { name: 'comentario', type: 'string' }, { name: 'nombre_cargador', type: 'string' }, { name: 'proyecto_name', type: 'string' }, { name: 'fecha_carga_usuario', type: "date", format: 'yyyy-MM-dd' } ] }; var addfilter = function(){ var filtergroup = new $.jqx.filter(); var filter_or_operator = 1; var filtervalue = 'Pendiente'; var filtercondition = 'contains'; var filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition); filtergroup.addfilter(filter_or_operator, filter1); $("#grillaActionItem").jqxGrid('addfilter', 'estado_txt', filtergroup); $("#grillaActionItem").jqxGrid('applyfilters'); } var dataAdapterA = new $.jqx.dataAdapter(sourceA); $("#grillaActionItem").jqxGrid( { source: dataAdapterA, selectionmode: 'none', theme: theme, width: '100%', height: document.documentElement.clientHeight - 210, pagesize: 15, pagesizeoptions: ['15', '30', '60', '120'], sortable: true, pageable: true, filterable: true, showfilterrow: true, autorowheight: true, columnsResize:true, localization: getLocalization(), ready: function () { addfilter(); }, columns: [ { text: 'Proyecto', dataField: 'proyecto_name', width: '35%' }, { text: 'Fecha de Carga', dataField: 'fecha_carga', cellsalign: 'center', cellsformat: 'dd-MM-yyyy HH:mm:ss', width: '16%' }, { text: 'Semáforo', dataField: 'a', width: '6%'}, { text: 'Descripción', dataField: 'titulo', width: '40%' }, { text: 'Usuario', dataField: 'usuario', width: '20%', hidden: true }, { text: 'Id', dataField: 'id_action_item', width: '10%', hidden: true }, { text: 'Id Proyecto', dataField: 'id_proyecto', hidden: true }, { text: 'Estado', dataField: 'estado', hidden: true }, { text: 'Responsable', dataField: 'responsable', width: '20%' }, { text: 'Severidad', dataField: 'severidad', width: '10%', cellsalign: 'center' }, { text: 'Impacto', dataField: 'impacto', width: '25%' }, { text: 'Estado', dataField: 'estado_txt', width: '10%', filtertype: 'checkedlist' }, { text: 'Fecha de Alta', dataField: 'fecha_carga_usuario', cellsalign: 'center', cellsformat: 'dd-MM-yyyy', width: '16%' }, { text: 'Fecha de Compromiso', dataField: 'fecha_compromiso', cellsalign: 'center', width: '16%', cellsformat: 'dd-MM-yyyy' }, { text: 'compromiso_original', dataField: 'compromiso_original', cellsformat: 'dd-MM-yyyy', hidden: true }, { text: 'Comentarios de Avance', dataField: 'comentario', width: '40%' }, { text: 'Reportó', dataField: 'nombre_cargador', width: '20%' }, { text: 'Cant Reprogramaciones', dataField: 'reprogramaciones', width: '15%', cellsalign: 'center' } ] }); }
Thank you for any help!
Gustav.PS: The first time works well, but on refresh didn’t work!
I think that the problem is in ‘ready’ because this call only once time when rendered the code.Hello Gustav,
I would suggest you to use render.
"Renders the Grid contents. This method completely refreshes the Grid cells, columns, layout and repaints the view."
Best Regards,
StanislavjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.