Hi everybody
Well, this time I come with a problem/solution that I was going to post but I gave it a try before posting, and found the solution. My employer wanted the filter dialog be able to be move around the screen. Since dragging objects is possible using prototype (
www.prototypejs.org) and scriptaculous (script.aculo.us), I just look around a little bit on the sigma grid code. I found out this, so I hope it can be useful for others.
First, using the excellent "Firebug" debugger for firefox (on the htlm view), I found out that filter dialogs on grid are created inside a <div> with an id something like this:
<div id="grdArticulos_grdArticulos_filterDialog_dialog">
Inside that goes the filter dialog for the specific id grid 'grdArticulos'
Next, after looking for "onclick" and "filterDialog" on the sigma grid source code (sigma grid 2.1), on line 3505 and on I found this:
},showDialog:function(D){
var A=this;
switch(D){
case "filter":
A.filterDialog=A.filterDialog||Sigma.RH3({title:A.getMsg("DIAG_TITLE_FILTER"),gridId:A.id});
A.filterDialog.show();
break ;
case "chart":
As you can see the code must be inserted in the case "filter": part, if you call an "alert(A.id)" you will find that this is the grid id "grdArticulos" in my case.
So last step is to use the scriptaculous Draggable class that moves things, (incredible simple) like this:
new Draggable(A.id + "_" + A.id + "_filterDialog_dialog");
Resulting this:
case "filter":
A.filterDialog=A.filterDialog||Sigma.RH3({title:A.getMsg("DIAG_TITLE_FILTER"),gridId:A.id});
new Draggable(A.id + "_" + A.id + "_filterDialog_dialog");
A.filterDialog.show();
break ;
You just call the draggable class with the id of the dialog window inside, that is concatenated just as is formed by sigma grid.
Well, of course, you have to add the prototype and scriptaculous libraries in your <head> section:
<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=effects,dragdrop" type="text/javascript"></script>
The result is very cool, because the end user can move the dialog window around the screen, allowing him to see the whole grid to do his filter stuff.
Hope it works for you.
Sergio