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
Show/hide grid
16/10/2008
15:00
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Hi.

I would like to show/hide a grid after the user sets two textfield in my form. Typically tow input that represent dates and when i click a button, if there is data found show it in the grid, otherwise hide the grid.

In my document.ready function I specify  hidegrid: false and hiddengrid:true, because I want the first time the grid don't be shown.

However I amg getting this error

Message: 'ts.p.colModel[...].align' is null or not an object

TIA

17/10/2008
09:01
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Check your data returned from server. You have some inconsistency

between colModel and the number of returned rows.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

17/10/2008
10:42
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Thanks Tony.

I already use this data in another place in my app and it is shown OK.

The only difference is in this part I just want to select/unselect rows, no CRUD is needed and I do not need to show all the fields that I have in json data...

17/10/2008
11:23
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Tony, I add all the columns and now it is working.

In the meantime I think i discover a bug. When you have a selected/unselected grid, select one row and sort for any column then you lose the selected row...

17/10/2008
15:43
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Is there a method to hide/show a grid ? What I want to do is show the grid only if data is found and if not data found show a message..

I enclosed the grid in a div and gives this div a hidden style but when i wnt to show it the grid "flashes" and did not be shown...

TIA

19/10/2008
07:47
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

How do you do that?

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

20/10/2008
08:48
Avatar
Seken
New Member
Members
Forum Posts: 2
Member Since:
20/10/2008
sp_UserOfflineSmall Offline

Hi people,

I'm having a doubt in Jgrid and need help.

I need that my column "id" stay hidden in the grid and in my form
it appears, not knowing I am doing this, anyone have any idea.

Thanks,

Seken

20/10/2008
09:25
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Note than i am uisng a flag to hide/show the grid but when I click in the "imgOK" the grid "flashes" and dissapears as the "ghideGrid" variable is created again...

 var ghideGrid = 1;
 
  jQuery("#imgOK").click(function() {  
                var fechaDesdeString = jQuery("#txtFechaDesde").val();
                var fechaHastaString = jQuery("#txtFechaHasta").val();
                
                if (fechaDesdeString == '') {
                    alert("Debe especificar la fecha Desde");
                    return false;
                }
                
                if (fechaHastaString == '') {
                    alert("Debe especificar la fecha Hasta");
                    return false;
                }
                
                // Realiza validaciones
                var dFechaDesde = Date.parse(fechaDesdeString);
                var dFechaHasta = Date.parse(fechaHastaString);
                
                if (dFechaHasta < dFechaDesde) {
                    alert("La fecha Hasta no puede ser menor que la fecha Desde");
                    return false;
                } else {
                    jQuery("#dataDiv").show();  
                    jQuery("#list").setPostData( { oper: "gm"} );
                    jQuery("#list").appendPostData( { desde: fechaDesdeString, hasta:fechaHastaString });
                    jQuery("#list").trigger("reloadGrid");
                    var ghideGrid = 0;
                    return  true;
                }
         });  
        
         jQuery("#list").jqGrid({
            caption: 'Empresas',
            colNames:['Codigo','Nombre', 'Sector', 'Status'],
            colModel :[ { name: "co_empresa",       index: "co_empresa",        width: 20, editable: false, sortable: false },
                        { name: "nb_razon_social",  index: "nb_razon_social",   width: 60, editable: false, sortable: false },
                        { name: "nb_sector",        index: "nb_sector",         width: 90, editable: false, sortable: false },
                        { name: "st_empresa",       index: "st_empresa",        width: 20, editable: false, sortable: false }
            ],
            //colNames:['Codigo','Nombre', 'Status'],
            //colModel :[ { name: "co_empresa",       index: "co_empresa",        width: 20, editable: false },
            //            { name: "nb_razon_social",  index: "nb_razon_social",   width: 60, editable: false },
            //            { name: "st_empresa",       index: "st_empresa",        width: 20, editable: false }
            //],
            datatype: "json",
            editurl: urlString,
            hidegrid: false,
            height: "47%",
            imgpath: "<%=Constantes.JQUERY_GRID_IMG_PATH%>",
            jsonReader: {
            repeatitems : true,
            id: "co_empresa"
            },
            loadtext: "<%=Constantes.JQUERY_GRID_LOADTEXT%>",
            loadui: "<%=Constantes.JQUERY_GRID_LOAD_UI%>",
            mtype: "<%=Constantes.JQUERY_GRID_MTYPE%>",
            pager: jQuery('#pager'),
            recordtext: "<%=Constantes.JQUERY_GRID_RECORDTEXT%>",
            rowNum: 10,
            sortname: "nb_razon_social",
            sortorder: "<%=Constantes.JQUERY_GRID_SORT_ORDER%>",
            toolbar: [true, "bottom"],
            url: urlString,
            viewrecords: true,
            width : 1000,
            multiselect:true,
            hidegrid: false,
            loadComplete:function() {
               if (ghideGrid == 1) {
                alert("hideGrid=" + ghideGrid);
                jQuery("#dataDiv").hide();  
                ghideGrid = 0;         
               }
               
            }
         }).navGrid("#pager", { refresh: false, edit: false, add: false, del: false, search: false });
});

<div id="dataDiv">  
    <table id="dataTable">
        <tr>
             <td>
               <table id="list" class="scroll" cellpadding="0" cellspacing="0"></table>
                <div id="pager" class="scroll" style="text-align:center;"></div>
            </td>
        </tr>
    </table>
</div>

20/10/2008
09:40
Avatar
Seken
New Member
Members
Forum Posts: 2
Member Since:
20/10/2008
sp_UserOfflineSmall Offline
I will try and post here.

Thank you very much

20/10/2008
13:55
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

I already did it! The process is as follows:

1) Enclosed your grid in a div and hides this div using style="display:none"

2) In the button or image you click to see if the grid could be visible just

 jQuery("#dataDiv").show(); 

I think it could be a good idea add a visible property to the grid to show/hide it programatically...

21/10/2008
01:15
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

It is a little dificult to do that since we create a lot of elements. I think that giving this freedom (like used from you) is better approach, rather than to put additinal code.

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

21/10/2008
09:28
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

I see your point, Tony

Thanks!

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
83 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