Jump to content

ganzqgy

Members
  • Posts

    132
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by ganzqgy

  1. 1.
    UniSession.AddJS('$.ajax({'
        + 'url: "' + UniSession.CallbackUrl('$.ajax', self, []) + '",'
        + 'type: "POST",'
        + 'data: {username:"g", abc:123},'
        + 'dataType: "text",'
        + 'success: function(data){'
        + '  alert("OK!"+data);'
        + '  }'
        + '});');
    procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;Params: TStrings);
    begin
    if EventName = '$.ajax' then
      begin
        UniEdit1.Text := 'AAAAAAA';    //Execution is not successful(Show no change)。  showmessage(UniEdit1.Text);(Display results correctly)         This is why?
        UniSession.AResponse.ContentText := '{"success":true,"manager":[{"name":"xxx","userId":"222"},{"name":"yyy","userId":"333"}]}';
      end;
    end;

     

    2.
    unisession.AddJS('ajaxRequest(MainForm.window,"ajaxRequest",[]);');
    procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;Params: TStrings);
    begin
    if EventName = 'ajaxRequest' then
      begin
        UniEdit1.Text := 'AAAAAA';     //Execution is successful(Show change)
        UniSession.Response := 'Ext.Msg.alert("","ok!");';
      end;
    end;

    • Like 1
  2. function beforerender(sender, eOpts)
    {  document.doEvt = function(el) {console.log(el.id);};
       sender.boundList.tpl.html ='

       <ul class="x-list-plain">
          <tpl for=".">
             <li role="option" unselectable="on" class="x-boundlist-item">
                <input id={[Ext.id()]} type="checkbox" onclick="doEvt(this)"/>
                {#}.{val}
             </li>
          </tpl>
       </ul>
       '
    }

     

    Dynamically add or delete, serial number is not normal。

    UniListBox1.Items.Add('fdsa');

    UniListBox1.Items.Delete(UniListBox1.ItemIndex );

     

    Why?

  3. procedure Ttyhgl.CDS1userGetText(Sender: TField; var Text: string;DisplayText: Boolean);
    begin
      text:=DecodeString(sender.AsString );
    end;

    procedure Ttyhgl.CDS1userSetText(Sender: TField; const Text: string);
    begin
      sender.AsString :=EncodeString(Text);      //not work
    end;

  4. 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!

  5. 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

  6. handleProgressBarClick : function(e){
            var parent = this.parent,
                displayItem = parent.displayItem,
                box = this.progressBar.getBox(),
                xy = e.getXY(),
                position = xy[0]- box.x,
                pages = Math.ceil(parent.store.getTotalCount() / parent.store.pageSize),
                newPage = Math.max(Math.ceil(position / (displayItem.width / pages)), 1);

            parent.store.loadPage(newPage);
        },

  7. function added(sender, container, pos, eOpts)
    {
       if (sender.pagingBar) {   
        sender.pagingBar.hide();
        sender.pagingBar.border = "0 none";   
        sender.pagingBar.destroy();
        sender.addDocked(
             {dock: 'bottom',          
              items: [Ext.create('Ext.PagingToolbar', {           
                pageSize: sender.store.pageSize,
                store: sender.store,
                displayInfo: true,           
                plugins: [Ext.create('Ext.ux.ProgressBarPager', {width: 300}),
                Ext.create('Ext.ux.PagingToolbarResizer',{displayText: 'Records per Page', options : [ 5, 10, 15, 20, 25,50,100 ]})]
              })]
             });      
      }        
    }

    PagingToolbarResizer.js.zip

    • Upvote 1
×
×
  • Create New...