Help!!!

32 views
Skip to first unread message

Алексей Титаренко

unread,
Aug 1, 2011, 8:54:48 AM8/1/11
to ext...@googlegroups.com
Нужна помощь..
В вызове DirectMethods динамически создается gridpanel, 

    <ext:GridPanel runat="server"
                   ID="gpDictView" 
                   Height="400"
                   Layout="Fit"
                   StripeRows="true"
                   TrackMouseOver="true"
                   Border="False">
      <Store>
        <ext:Store ID="dsDictView"
                   runat="server"
                   AutoLoad="false"
                   OnRefreshData="dsDictView_Refresh" >
          <Reader>
            <ext:JSONReader />
          </Reader>
        </ext:Store>                
      </Store>
      <SelectionModel>
          <ext:RowSelectionModel runat="server" SingleSelect="true" />
      </SelectionModel>
      <View>
        <ext:GridView runat="server" ScrollOffset="0" ForceFit="true"/>
      </View>
 </ext:GridPanel>

добавил кусок для создания <plugins><ext:GridFilters>...</plugins>, но он не отрисовывается..Что посоветуете??

Vladimir Shcheglov

unread,
Aug 1, 2011, 9:53:24 AM8/1/11
to ext...@googlegroups.com

Поажите код директ метода

Алексей Титаренко

unread,
Aug 1, 2011, 10:05:33 AM8/1/11
to ext...@googlegroups.com
    private void BuildDict(int iddict)
    {
gpDictData.Plugins.Clear();
GridFilters gfDictData = new GridFilters();
gpDictData.Plugins.Add(gfDictData);

      try
      {
        string dname = string.Empty;
        string tname = string.Empty;

        IRefBook refbook = DMFEnvironment.CurrEnvironment.Provider.GetObject(typeof(IRefBook)) as IRefBook;
        if (refbook != null)
        {
          DataTable dt = refbook.GetSpr(iddict, UserData.Data.IdOrg, true, out tname);
          Session[ucDictionaryRecEdit.CTBLSTRUCTURE] = dt.Columns; // Сохраняем в сессии структуру текущей таблицы
          Session[ucDictionaryRecEdit.CTBLNAME] = tname;
          //Session[ucDictionaryRecEdit.CTBLID] = iddict;

DataColumnCollection tableColumns = dt.Columns;

          Dictionary<string, Dictionary<string, string>> cols = refbook.GetAttributeSprBySprID(iddict);

          // Изменяем DataStore
          if (X.IsAjaxRequest) this.dsDictData.RemoveFields();

          foreach (KeyValuePair<string, Dictionary<string, string>> kvp in cols)
          {
            this.AddField(new RecordField(kvp.Key));
          }
          this.dsDictData.ClearMeta();

          // Биндим справочники
          this.dsDictData.DataSource = dt;
          this.dsDictData.DataBind();

          // Строим ColumnModel
          foreach (KeyValuePair<string, Dictionary<string, string>> kvp in cols)
          {
            string dataField = kvp.Key;
            Dictionary<string, string> col = kvp.Value;

Column _dataColumn = new Column();
_dataColumn.DataIndex = kvp.Key;
_dataColumn.ColumnID = kvp.Key;
_dataColumn.Hidden = (string.IsNullOrEmpty(col["visible_in_grid"])) ? true : ((col["visible_in_grid"] == "0") ? true : false);
_dataColumn.Header = col["caption"];
            this.gpDictData.ColumnModel.Columns.Add(_dataColumn);

//if (tableColumns.Contains(_dataColumn.DataIndex))
//{
//  DataColumn dataColumn = tableColumns[_dataColumn.DataIndex];
//  if (dataColumn.DataType == typeof(DateTime))
//  {
//    DateFilter _filter = new DateFilter();
//    _filter.DataIndex = _dataColumn.DataIndex;
//    gfDictData.Filters.Add(_filter);
//  }
//  else
//  {
StringFilter _filter = new StringFilter();
_filter.DataIndex = _dataColumn.DataIndex;
_filter.SetActive(true);
_filter.AutoDataBind = true;
gfDictData.Filters.Add(_filter);
//  }
//}
          }

if (X.IsAjaxRequest)
{
this.gpDictData.Reconfigure();
//this.gpDictData.RefreshView();
}
        }
        else
        {
          log.Warn("## BuildDict ##, Не удается получить IRefBook");
        }
      }
      catch (Exception ex)
      {
        log.Error("## BuildDict ##", ex);
      }
    }

Алексей Титаренко

unread,
Aug 1, 2011, 10:06:32 AM8/1/11
to ext...@googlegroups.com
В ДиректМетоде вызывается именно эта функция..

Daulet Urazalinov

unread,
Aug 1, 2011, 11:21:16 AM8/1/11
to Ext.NET
В свое время я переделывал это через этот пример
http://examples.ext.net/#/GridPanel/RowExpander/Dynamic_GridPanels/

Может поможет

quirkmind

unread,
Aug 1, 2011, 1:03:25 PM8/1/11
to Ext.NET
Вы не создаёте грид динамически, просто меняете его структуру
Плагины не могут быть добавлены динамически (в уже созданный на
клиенте виджет)
Здесь надо пересоздавать грид (вызов Render)

On 1 авг, 19:21, Daulet Urazalinov <d.urazali...@gmail.com> wrote:
> В свое время я переделывал это через этот примерhttp://examples.ext.net/#/GridPanel/RowExpander/Dynamic_GridPanels/

Daulet Urazalinov

unread,
Aug 1, 2011, 2:41:42 PM8/1/11
to Ext.NET
В нельзя ли сделать так как описано в этой ветке:
https://groups.google.com/group/extnet/browse_thread/thread/87828a9458f4c376
?

Алексей Титаренко

unread,
Aug 2, 2011, 2:21:26 AM8/2/11
to ext...@googlegroups.com
Спасибо за ответ...

Reply all
Reply to author
Forward
0 new messages