2012-12-12 4 views
1

filterToolbar 검색 상자를 내 눈금에 추가하고 높이 스타일을 this 질문에 과 같이 변경했습니다.jqgrid 필터 도구 모음 검색 입력 정렬 센터

이 입력을 가운데에 배치하려면 (text-align:center을 시도했지만 작동하지 않았습니다). 입력란을 가운데에 맞출 수있는 방법은 무엇입니까?

UPDATE : 이 내 colModel 코드 :

{width:10,name:'Code1',index:'Code1', jsonmap:'Code1',searchoptions:{dataInit: function(elem){$(elem).css('font','15px'); $(elem).height(18);}}}, 
{width:40,name:'DescriptionHe1',index:'DescriptionHe1', jsonmap:'DescriptionHe1',searchoptions:{dataInit: function(elem){$(elem).css('font','15px');$(elem).height(18);}}, hidden:(language == "he")?false:true}, 
{width:40,name:'DescriptionEn1',index:'DescriptionEn1', jsonmap:'DescriptionEn1',searchoptions:{dataInit: function(elem){$(elem).css('font','15px');$(elem).height(18);}}, hidden:(language == "en")?false:true},              
{width:10,name:'Code2',index:'Code2', jsonmap:'Code2',searchoptions:{dataInit: function(elem){$(elem).css('font','15px'); $(elem).height(18);}}}, 
{width:40,name:'DescriptionHe2',index:'DescriptionHe2', jsonmap:'DescriptionHe2',searchoptions:{dataInit: function(elem){$(elem).css('font','15px');$(elem).height(18);}}, hidden:(language == "he")?false:true}, 
{width:40,name:'DescriptionEn2',index:'DescriptionEn2', jsonmap:'DescriptionEn2',searchoptions:{dataInit: function(elem){$(elem).css('font','15px');$(elem).height(18);}}, hidden:(language == "en")?false:true}              

감사의 사전.

답변

2

추가 CSS를 사용하면 jqGrid의 기본 동작이 변경된다고 가정합니다. jqGrid 기본 검색 도구 모음의 모든 입력 필드는입니다.

검색 막대에서 요소의 스타일을 변경하려면 searchoptionsattr을 사용할 수 있습니다. 다음

The demo 표시 : 데모가 검색 바의 모든 요소에 대한 공통의 스타일을 설정할 수

cmTemplate: { 
    searchoptions: { 
     attr: { 
      style: "width:auto;padding:0;max-width:100%" 
     } 
    } 
} 

를 사용

enter image description here

. 또한 다른 열에 대해 maxlengthsize 속성을 설정했습니다. 예를 들어

searchoptions: { attr: { maxlength: 6, size: 6 }} 

Another demo은 검색 도구 모음의 다른 요소에 대해 서로 다른 정렬을 설정하는 방법을 보여줍니다 :

enter image description here

내가 왼쪽 정렬에 사용되는 데모에서는이 속성을 필드

searchoptions: { 
    attr: { 
     maxlength: 6, 
     size: 6, 
     style: "width:auto;padding:0;max-width:100%;float:left" 
    } 
} 

searchoptions: { 
    attr: { 
     maxlength: 6, 
     size: 6, 
     style: "width:auto;padding:0;max-width:100%;float:right" 
    } 
} 

오른쪽 맞춤 필드 용.

style: "width:auto;padding:0;max-width:100%;height:5em;float:left" 

P.S. :

내가 searchoptions.attr.style 내부 height을 사용하는 입력 필드의 높이를 설정하려면 나는 CSS를 추가로 사용하여 검색 툴바의 가시성을 향상시키기 위해 CSS를 사용했다.

+0

자세한 답변을 보내 주셔서 감사합니다. 당신이 한 코드를 변경하려고 시도했지만, 잘 작동하지 않습니다, 나는 여전히 센터에서 입력을 볼 수 없습니다. 검색 입력의 높이를 높이고 측면에 약간의 공간을두고 100 % 너비가되도록하고 싶습니다. 이것이 가능한가? (내 코드로 질문을 업데이트했습니다). 감사! – user590586

관련 문제