Sigma Php Ajax framework, Ajax Components, GUI Builder
May 21, 2012, 08:17:16 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Moving filter dialog (problem and solution)  (Read 1101 times)
sergon
Jr. Member
**
Posts: 13


View Profile
« on: April 07, 2009, 11:36:32 PM »

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
Logged
steven
Moderator
Hero Member
*****
Posts: 544



View Profile
« Reply #1 on: April 08, 2009, 02:10:56 AM »

awesome!!!!! Shocked Shocked Shocked
Some features are not supported by sigma grid natively because we would like sigma grid to keep fit.
At this time, you may need 3d-party library to achieve some specs.
We encourage you to share more stuff on how to integrate with  3d-party library.
Some more more knowledge on this point could be find once sigma wiki has been built up.
Logged

Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
humi
Hero Member
*****
Posts: 284


View Profile
« Reply #2 on: April 10, 2009, 06:27:43 AM »

When can we expect a Sigma Wiki?
Logged
steven
Moderator
Hero Member
*****
Posts: 544



View Profile
« Reply #3 on: April 12, 2009, 07:54:08 AM »

we are building it now. Coming soon
Logged

Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!