项目不会显示在下拉列表中

时间:2017-01-21 09:14:36

标签: extjs

我的页面中有一个comboBox?看起来像这样 商店

Create PROCEDURE SelRefRecoFactor_RegStatus
@BizID bigint
AS
BEGIN
DECLARE @RecCnt INT
SELECT RegistrationStatusCode,BusinessDetail.UserId,  UserReferenceTierId,      CASE AllowReservationConfirmation WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' END AS AllowReservationConfirmation
 FROM BusinessDetail WITH (NOLOCK)
INNER JOIN UserLogin WITH (NOLOCK) on BusinessDetail.UserId= UserLogin.UserId
WHERE BusinessId =@BizID

SELECT @RecCnt = COUNT(ReferenceTier1PercentValue) FROM ReferenceTierInfo  WITH (NOLOCK)  
INNER JOIN BusinessDetail WITH (NOLOCK) on BusinessDetail.UserId=ReferenceTierInfo.UserId WHERE BusinessDetail.BusinessId =@BizID  AND ( GETDATE() between FromDate and ToDate)

IF(@RecCnt>0)
    BEGIN
        SELECT ReferenceTier1PercentValue, ReferenceTier2PercentValue  FROM ReferenceTierInfo  WITH (NOLOCK)  
         INNER JOIN BusinessDetail WITH (NOLOCK) on BusinessDetail.UserId=ReferenceTierInfo.UserId WHERE BusinessDetail.BusinessId =@BizID   AND ( GETDATE() between FromDate and ToDate)
    END

ELSE
    BEGIN
        SELECT ReferenceTier1PercentValue, ReferenceTier2PercentValue FROM ReferenceTierInfo WITH (NOLOCK)  WHERE UserId = 0  AND ( GETDATE() between FromDate and ToDate)
    END

SELECT @RecCnt=  COUNT(RecommendationPercent) FROM RecommendationPercentInfo  WITH (NOLOCK)
INNER JOIN BusinessDetail  WITH (NOLOCK)  ON BusinessDetail.UserId = RecommendationPercentInfo.UserId 
INNER JOIN CountryMaster WITH (NOLOCK)  ON RecommendationPercentInfo.CurrencyCode = CountryMaster.CurrencyCode 

  WHERE BusinessId =@BizID AND (getdate() between FromDate and ToDate)
IF(@RecCnt>0)
    BEGIN
    SELECT DISTINCT   RecommendationPercentInfo.RecommendationPercent,
      RecommendationPercentInfo.RecommendationService
    FROM
      RecommendationPercentInfo WITH (NOLOCK)
      INNER JOIN BusinessDetail WITH (NOLOCK) ON (BusinessDetail.UserId = RecommendationPercentInfo.UserId)
      INNER JOIN CountryMaster WITH (NOLOCK) ON (RecommendationPercentInfo.CurrencyCode = CountryMaster.CurrencyCode)
    WHERE
  BusinessId = @BizID AND 
  getdate() BETWEEN FromDate AND ToDate
    END

ELSE
    BEGIN
         SELECT DISTINCT RecommendationPercent, RecommendationService FROM RecommendationPercentInfo  WITH (NOLOCK)
         INNER JOIN CountryMaster WITH (NOLOCK)  ON RecommendationPercentInfo.CurrencyCode = CountryMaster.CurrencyCode 
         INNER JOIN BusinessDetail  WITH (NOLOCK)  ON BusinessDetail.CountryCode = CountryMaster.CountryCode 
         WHERE BusinessId =@BizID AND (getdate() between FromDate and ToDate) AND RecommendationPercentInfo.UserId = 0 
    END

组合配置

var sourcesStore = new Ext.data.Store({
    autoLoad:true,
    storeId: 'sourcesStore',
    listeners:Ext.ux.loaderListener,
    proxy:new Ext.data.HttpProxy({
        url:'/traffic/traffic_source_list/1',
    }),
    reader:new Ext.data.JsonReader(
        {
            root:'items',
            id:'source_',
            messageProperty:'msg',
            successProperty:'success',
            fields: ['id', 'name']
        },
        ['id', 'name']
    )
});

并在此设置项目

var selectStyleComboboxConfig = {
    fieldLabel: 'My Dropdown',
    name: 'type',
    allowBlank: false,
    editable: false,
    // This is the option required for "select"-style behaviour
    triggerAction: 'all',
    typeAhead: false,
    mode: 'local',
    width: 120,
    listWidth: 140,
    hiddenName: 'traffic_source',
    /*store: [
        ['val1', 'First Value'],
        ['val2', 'Second Value']
    ],*/
    store: sourcesStore,
    readOnly: true
};

问题是它没有显示要在下拉列表中选择的项目。我们在项目中使用ext 2.3.0当我点击选择时,我看到一个下拉很长的一个,但它是空的。我是extJS的新手,我迫切需要帮助来解决这个问题。对不起我的英语,如果需要更多信息或详细信息 - 请告诉我!

1 个答案:

答案 0 :(得分:0)

谢谢,答案非常简单。我刚刚添加了

valueField: 'id',
displayField: 'name'

现在很好!