Sigma Php Ajax framework, Ajax Components, GUI Builder
May 21, 2012, 09:32:07 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: String column maxlength  (Read 2169 times)
gbolanoscruz
Moderator
Full Member
*****
Posts: 22


View Profile
« on: March 24, 2008, 08:51:16 AM »

who I can restrict the number of characters on a string cell?

example:
I have something like that:



but I need to limit the number of character that column accept, like 'maxlength' on a textbox...

Anyone can help me?  Huh
Logged
steven
Moderator
Hero Member
*****
Posts: 544



View Profile
« Reply #1 on: March 25, 2008, 04:21:58 PM »

You need to build up a customized editor. In your editor, you can specify anything, just as you can do with html input.
The following code snippet may give you some sense Smiley.

var lenLimitStringEditor = new function(){
   var maxLenth = 10;
   this.paint = function(grid,row,col){
    var data = row.getCellValue(col);
    var s = [];
    s[s.length] = '<input type=text onblur="s_grid_cellBlur('
    s[s.length]= grid.id+',this.parentNode,event);"'
    s[s.length] ='" onkeydown="s_grid_cellFocusHandle('
    s[s.length] = grid.id;
    s[s.length] =',this.parentNode,event);" style="border-width:0px;height:19px;width:100%;" maxLength=';
    s[s.length] =maxLenth+' />';
    return s.join('');
   }
  }
  var columns = [
   {name:"name",caption:"Product",width:120,mode:"string",editor:lenLimitStringEditor}
   ];
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
gbolanoscruz
Moderator
Full Member
*****
Posts: 22


View Profile
« Reply #2 on: March 27, 2008, 07:50:08 AM »

Excellent!

It works perfectly!!!  Grin

Thanks a lot!  Wink
Logged
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!