Jump to content

DBGRID Action Columns at Design Time


Recommended Posts

procedure TBMUniDBGrid.LoadCompleted;
var Obj       : TExtFunction;
    objCols   : TExtFunction;
    i         : integer ;
    Cols      : string ;
begin
   if FactionColumnEvent = '' then   FactionColumnEvent := 'ColsActionEvent' ;
   if FCheckBoxSelect  then  begin
     self.Options := self.Options + [dgRowSelect];
     self.Options := self.Options + [dgMultiSelect];
   end
   else begin
     self.Options := self.Options - [dgRowSelect];
     self.Options := self.Options - [dgMultiSelect];
   end;
   if FActionButtons.Count > 0 then begin
              Cols :=' eColumn = new Ext.grid.column.Action( {'+
            'xtype : ''actioncolumn'','+
             'width : ' + inttostr(FactionColumnWidth) + ', sortable : false , menuDisabled : true ,'+
             'items : [' ;
    for i := 0 to FActionButtons.Count - 1 do begin
        Cols := Cols +
       ' {  icon: ' + quotedstr( StringReplace(FActionButtons.Items.FIconFilename,'\','/',[RfReplaceAll])) + ',' +
                'tooltip: ' + quotedstr(FActionButtons.Items.ToolTip) + ',' +
                'handler: function (grid , rowIndex, colIndex) {'+
                 'grid.getSelectionModel().select(rowIndex);'+
                 'ajaxRequest(' +  self.jsname +',' + quotedstr(FActionColumnEvent) +  ',["Buttons=" + "' +FActionButtons.Items.ButtonName+  '"]);'+
                 '}},';
    end;
    if FActionColumnPos = Last then
       Cols := copy(Cols,1,length(Cols) - 1) + ' ]} ); columns.push(eColumn) ;'
    else   Cols := copy(Cols,1,length(Cols) - 1) + ' ]} ); columns.unshift(eColumn) ;' ;
    objCols :=  JsFunction('sender, store, columns, oldStore, the, eOpts', Cols) ;
    Self.jsgridpanel.on('beforereconfigure',Objcols);
    Objcols.free();
   end;
  Self.ClientEvents.UniEvents.add('pagingBar.beforeInit=function(sender, config){'
    +'sender.displayInfo= true;'
    +'var pbp=Ext.create("Ext.ux.ProgressBarPager", {width:200});'
    +'var ptr=Ext.create("Ext.ux.PagingToolbarResizer",{displayText:"  分页行数:",options:[1,5,10,15,20,25,50,100,2000]});'
    +'sender.plugins=[pbp,ptr]'
    + '}');
  Obj := JSFunction('sender, selected, eOpts',
    'var ArrayOfIndex = []; for (var i in selected){ArrayOfIndex.push(selected.index);}' +
    ' ajaxRequest(sender, "selectionchange", ["ArrayOfIndex="+Ext.encode(ArrayOfIndex)]);') ;
    Self.jsgridpanel.on('selectionchange',Obj);  
  Obj.Free();
  inherited;
end;

 

 

 

 

JSObjects.JSClasses['pagingBar'] := 'Ext.toolbar.Paging';

 

Paging control,No paging can not use

Link to comment
Share on other sites

Hi Anthoni ,

 

what error you receive?

 

Salvatore Marullo

 

When I try and load the package into Delphi, the IDE itself crashes with delphicore.bpl Access Violation.

However when I then try and create a new package with just the Pascal file and then build under 64 I get :-

[dcc64 Fatal Error] BMUniDBGrid64.dpk(33): E2202 Required package 'designide' not found

 

Any ideas ?

Link to comment
Share on other sites

Hi Kiener , 

 

Let's see if I can explain. 
 
 
If you use my BMUnidbgrid component has the ability to add 
 
PagingToolbarResizerer posted by Mr. Delphi Developer. 
 
Please set Property  PagingToolbarResizer to  true . 

 

 
 
 
See:
 
 
 
 
post-1298-0-68335900-1411469085_thumb.png     post-1298-0-68937400-1411469663_thumb.png
 
 
OK! 
 
 
in truth I did not foresee the possibility of using the original unigui PagingToobar, 
 
also because the one posted by Mr. Delphi Developer seems to me more nice. 
 
 

 

I hope I was clear.

 

 
 
 
Best Regards 
 
Salvatore Marullo 
Link to comment
Share on other sites

in all extjs4.2,   work! good!

 

Self.ClientEvents.UniEvents.add('pagingBar.beforeInit=function(sender, config){'
    +'sender.displayInfo= true;'
    +'var pbp=Ext.create("Ext.ux.ProgressBarPager", {width:200});'
    +'var ptr=Ext.create("Ext.ux.PagingToolbarResizer",{displayText:"  分页行数:",options:[1,5,10,15,20,25,50,100,2000]});'
    +'sender.plugins=[pbp,ptr]'
    + '}');

 

 

but:

sender.plugins=[Ext.create("Ext.ux.ProgressBarPager", {width:200}),ptr];--------------------------not work!

Link to comment
Share on other sites

hi, 

 

I think we've created a bit of confusion with the new release of Unigui and ExtJS (0.97 and ext-4.2.2.1144), especially with Plugins (PageSize e ProgressBar  Extension)  posted by Delphi Developer. 

 

It seems to me that everything works as before. 

 

I made some small changes to the TBMUniDBGrid and this is the result, without writing a line of code from the client site.

 

 

post-1298-0-89964100-1411568183_thumb.png

 

 

If anyone is interested, I can post the changes.

 

 

Best Regards .
Link to comment
Share on other sites

Hi rullamore,

 

That works for me..

procedure TBMUniDBGrid.ConfigJSClasses(ALoading: Boolean);
begin



  JSObjects.DefaultJSClassName     := 'Ext.grid.Panel';
  JSObjects.JSClasses['cellModel'] := 'Ext.selection.CellModel';
  JSObjects.JSClasses['rowModel']  := 'Ext.selection.CheckboxModel' ;
  JSObjects.JSClasses['store']     := 'Ext.data.Store';
  JSObjects.JSClasses['pagingBar'] := 'Ext.toolbar.Paging'; <-- that adds the standard toolbar
end;

However, i did not find the "PagingToolbarResizer" Property in my object inspector. Maybe i has to install first PagingToolbarResizerer posted by Mr. Delphi Developer, then the property is shown. i will try..

Link to comment
Share on other sites

Hi rullamore,

 

It works perfect until i set the property "PagingToolbarResizer" to "True". if i set it to "false", i can see the original grid toolbar. If i set it to "True", see the attached pictures. Maybe it has to do that i have to install the "PagingToolbarResizer". But that seems to me a bit complicated. Can you give me al little help?

post-1520-0-48728600-1411740114_thumb.png

post-1520-0-41363400-1411740116_thumb.png

Link to comment
Share on other sites

Hi Kiener, 

 

Define in   ServerModule -> CustomFiles   

 

  files/PagingToolbarResizer.js 
  files/ProgressBarPager.js 
 

please uses the files that I have attached to "Files" folder of demo program  :  

 

 

I made some small changes to avoid the message you received .

 

 

I hope this will solve your problems. 
 
P.Š. you do not need UniZDBGrid , sorry. 
 
 
regards. 
Link to comment
Share on other sites

Hi Kiener, 

 

Fine ! 
 
 
Honestly, I do not know. 
 
it is nice to see, especially if you are not using PagingToolbarResizer and  you can see graphically how many records you've already displayed in grid . 
 
 
Set the property   ProgressBarPager  to true, and you can see the result. 
 
see  :
 

 

 

 
 
 
 
Regards 
Link to comment
Share on other sites

  • 5 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...