How to dynamically bind a Query to a grid? - grid

I have a Query that the datasources it is set to can change dynamically. I want to take the results of this Query and bind that to a Grid, so each time it may have new fields, and data.
I already added a Grid to my form, and added the Common table as a datasource. I tried to set the dataSource of the grid, and iterate through the fields and dynamically add them, but no data is showing up.

Have a look on the form SysTableBrowser.
It builds the grid based on a tableId.
Maybe you can change SysTableBrowser to accept a query.
Good luck!

Related

Kendo UI grid subrow

I need to develop a Kendo grid as the one in the mockup that follow:
This is simple, but when a special value is selected in one of the select fields, a sort of sub-row must be displayed:
So, this set of 3 (or 6) fields is what I need to have on every grid row. That means I need to add other rows like this, being able to liveedit them or delete.
I'm wondering what is the best way to reach this (if possibile).
Can I simply define the whole set of fields (with sub-row) as a single grid row then split someway it using CSS or Kendo grid already support this kind of layout?
The Kendo UI grid is a widget which allows you to visualize and edit data via its table representation, KendoGrid is not best approach in my opinion.
You just need to create on kendo template, with you 3 static dropsdown's and when you click on your "special" value you will have to append your template again with other data if is needed.
Check on KendoTemplate docs.
EDIT: So you will have to use kendogrid detail (hardcoded), and use tempate to show you 3 fields I think.
Hope this help

Is there a way to arrange the columns in the grid when the Sales order list page is loaded?

I'm stuck with an issue in the sales order Grid in Dynamics AX 2012 R2. Somehow after adding new columns to the grid via personalization, the newly added columns always shifts to the left side after closing/opening the sales order list page.
Is there any Grid property that handles the arrangement of the columns?
how can we modify the grid columns?
Thanks!
Well, it sounds like an error, this is not how it works for me.
Consider adding the fields to the SalesTableListPage form. The fields are initially (or after reset of user settings) listed in the order in the form grid.
Might look into the list page interaction classes which is responsible for form behavior instead of the AOT on listpages.
more information on the available methods can be found on msdn
https://msdn.microsoft.com/en-us/library/listpageinteraction.aspx
but it is possible for example that a var/isv customization modifies the form after it is loaded

make a cell as template field in GridView

I have a grid view which is dynamically populated with data. and the no.of columns may be changed each time according to the query.. i want to make the first field to select the row of data(by making it template field). I cannot declare statically the columns as template fields because the column numbers are dynamic.
can any one help how to proceed.
You need to create your own template builder - a class implementing ITemplate interface - use InstantiateIn to build your template by adding needed controls to the given template container. Add TemplateField column to the grid-view and use your class as ItemTemplate.
See this article where this is illustrated: http://www.mindfiresolutions.com/How-to-add-a-TemplateField-to-a-GridView-dynamically-841.php
Further, what you want to achieve might be possible by creating your custom DataControlField - for example, for selection column, I may use a class inherited from CheckBoxField (something like http://www.asp.net/data-access/tutorials/adding-a-gridview-column-of-checkboxes-cs)
It's a bit of work but the following article walks through all of the steps: How to create template columns dynamically in a grid view
There is no easy answer for what you're trying to do but the above link will help you if you are willing to put in the time and effort to get it done.

Flex DataGrid prevent a filter from being applied automatically

To situate things I am working on a translation utility with a datagrid having 3 columns : translation code, reference text and target text.
The DataGrid's dataProvider property is bound to an ArrayCollection instance. The user can edit the grid and on a successful edit, the underlying collection is updated using the setItemAt() method. The collection also has a filter function to make it easier to find certain texts.
When the user clicks the 'apply filter' button the filter function is updated. This works well. The problem I have is that rows are hidden as soon as the underlying collection item change in a way that doesn't comply with the filter. The row is hidden immediately, which is not very user friendly. Rows should only hide (or be shown) when the 'apply filter' button is pressed.
I'm searching for a way to make this happen.
I assume you mean that the DataGrid's dataProvider is bound to an ArrayCollection instance?
Anyway, if you want to filter the DataGrid's dataProvider then that will remove rows from the DataGrid. You can remove the filter to add them back in. Something, conceptually like this:
collection.filterFunction = null;
collection.refresh();
If you are using the dataProvider as a source for multiple components, you can keep the filtering separate by using a different ListCollectionView for each one, but with the same source. Something like this:
component1.dataProvider = ListCollectionView(mySource);
component1.dataProvider = ListCollectionView(mySource);
Now applying a filter to one dataProvider will not affect the other.
If this doesn't help, you'll need to expand on the issue you're having and perhaps provide sample code.
After asking and looking around, I determine that there is no real way to do this. I did solve my problem however, by doing the filtering myself and only keeping a list of 'primary keys'. I then use that list to filter the collection.
The result is that rows can't suddenly disappear when records are changed, which is what I wanted.

Grid View Generic Functions

currently I am using few generic functions/methods in gridview for Sorting Images and Getting Header Row in TH and merge Header Row.
Link
http://marss.co.ua/MergingGridViewHeaderColumns.aspx
problem is i have to write these function for every Grid. I looking for solution, Where I can define these behaviors only at one place.
Create an object that inherits from the GridView. Add your properties and functionality to that new object. On your page add that new object instead of the GridView. And if you go totally nuts like I did, you can end up creating a totally different control. See the
GridViewTree.

Resources