OlegTimkiv Posted January 10, 2019 Share Posted January 10, 2019 Здравствуйте! Когда в "DBTreeGrid" группировка "TreeKeyFields". Выбираю родительский узел. DataSource - не переходит на дочерний узел. Как можно реализовать переход? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 10, 2019 Share Posted January 10, 2019 Здравствуйте, Простите, можете уточнить Ваш вопрос? Quote Link to comment Share on other sites More sharing options...
OlegTimkiv Posted January 10, 2019 Author Share Posted January 10, 2019 9 minutes ago, Sherzod said: Здравствуйте, Простите, можете уточнить Ваш вопрос? Когда выбрали "Bahamas", dataset должен установиться на первую запись (Nassau). Когда переходим по дочерним записям, работает нормально. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 10, 2019 Share Posted January 10, 2019 1 hour ago, OlegTimkiv said: Выбираю родительский узел. DataSource - не переходит на дочерний узел Думаю, что это нормальное поведение, не так ли? 1 hour ago, OlegTimkiv said: Как можно реализовать переход? Т.е., Вы хотите перейти на первый дочерний узел, который не имеет дочернего узла... ?! Quote Link to comment Share on other sites More sharing options...
OlegTimkiv Posted January 10, 2019 Author Share Posted January 10, 2019 9 minutes ago, Sherzod said: Думаю, что это нормальное поведение, не так ли? Т.е., Вы хотите перейти на первый дочерний узел, который не имеет дочернего узла... ?! Да Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 10, 2019 Share Posted January 10, 2019 Ok, я проанализирую и дам Вам знать. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 10, 2019 Share Posted January 10, 2019 Попробуйте следующий подход...: 1. UniDBTreeGrid -> ClientEvents -> ExtEvents -> function store.nodeexpand function store.nodeexpand(sender, eOpts) { var grid=this.grid, f; if (sender.data.root==true) {return}; sender.cascadeBy( function(){ if (f) return false; if (!this.get("leaf")) { this.expand(); } else { ajaxRequest(grid, "_sel", ["rec="+this.data[1]]); // Индекс Вашего ключевого поля f=true; } }); } 2. UniDBTreeGrid -> OnAjaxEvent: procedure TMainForm.UniDBTreeGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = '_sel' then TUniDBGrid(Sender).DataSource.DataSet.Locate('KeyField....', Params.Values['rec'], []) end; Quote Link to comment Share on other sites More sharing options...
OlegTimkiv Posted January 11, 2019 Author Share Posted January 11, 2019 17 hours ago, Sherzod said: Попробуйте следующий подход...: 1. UniDBTreeGrid -> ClientEvents -> ExtEvents -> function store.nodeexpand function store.nodeexpand(sender, eOpts) { var grid=this.grid, f; if (sender.data.root==true) {return}; sender.cascadeBy( function(){ if (f) return false; if (!this.get("leaf")) { this.expand(); } else { ajaxRequest(grid, "_sel", ["rec="+this.data[1]]); // Индекс Вашего ключевого поля f=true; } }); } 2. UniDBTreeGrid -> OnAjaxEvent: procedure TMainForm.UniDBTreeGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = '_sel' then TUniDBGrid(Sender).DataSource.DataSet.Locate('KeyField....', Params.Values['rec'], []) end; Спасибо большое! Все работает. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 11, 2019 Share Posted January 11, 2019 Пожалуйста! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.