Reorder Entity Properties - asp.net

I have an Entity (Extensions) with a number of properties (e.g. id, extension, prefix) and a few navigation properties (phones_departments, phones_buildings) - they show up in the order they display in the EDMX...but what if I want them to display in a different order? I'm using Dynamic Data - is there a way to accomplish this?

are you showing your data in a grid?
if yes, you could sort grid columns based on some other property. You could for example have a ColumnOrder property in your data store and update that. The code to sort the columns varies per grid, but it is usually easy to do.
Main point being is that you want to modify the display level logic, not the way the actual object is created. since your order can always very per application.

Related

Display label based on, field on one data-source (singular) being within another data-source fields many

I am still learning, and looking for help on how to display a label based on one data-sources field value, being within another data-sources field value list.
I have one calculated table, displaying rows of documents within a folder, and wish to use a field representing the document number in that data-source, so that if it's ANYWHERE within another tables field it displays my label.
I've been trying to use projection as I think this is how to achieve it.
I can get it working based on both the current #datasouce.item.fieldnames but need it to base the calculation on all possible numbers in that tables field (Image below should make it easier to understand).
I expect that it has something to do with projections, but can't find anything within the learning templates or anywhere else to resolve the issue.
I think the following should work for you. For the 'Reserved' label have the following binding for the text property:
(#datasources.project_quotes.items..quotenumber).indexOf(#widget.datasource.item.Qnumber) !== -1 ? 'Reserved' : ''
I would suggest alternatively just to include a field in your calculated datasource and making the determination in your server script.

Symfony Form multiple range field

I need to make a search form where I need a range slider so a user could choose price_from and price_to. Something like this
What is the best way to implement it?
The only I have found is range type field
It is pretty close to what I need, but it has only one value while I need two values (price_from and price_to)
You are are correct to assume that you need two values (min and max). When I encountered a similar problem, I created two hidden fields for the same purpose.
To fill those hidden fields with values, I used a JS library that rendered the widget and stored the user's input in the hidden form fields:
https://refreshless.com/nouislider/

Creating an expandable grid in MVC3 - data modelling

I am trying to create an expandable grid in MVC3. This is a follow up question to this .
Basically I have a complicated sql query that I need to use to populate a set of fields in a grid in MVC3. Also the grid elements must be expandable and on expansion should show additional data.
For example
I have two sql queries
Query A
select * from large tables joined
Query B
select data from selected row in query A
Query A represents my first query which I should use to populate the grid. On expansion of the grid I have to show the additional data by expanding the row from A with the query B.
I am creating a view model with all the fields I need in the first row of the grid that I can pass to the view.
Questions:
1.) How do I directly use sql to pass the data into the views instead of joining the models
2.) How do I make the grid expandable to show additional data?
3.) How do I model my sql, do I create one query for both and then selectively show data?
Caveat: MVC3 noob
Answers inline
Questions:
1.) How do I directly use sql to pass the data into the views instead of joining the models
This depends, either you pass in everything up front and write out hidden fields, or a hidden JSON object containing all the data and when the field is expanded, show it. so that is: Render all the data in your grid and hide each item until you need it, or dynamically load it from an array and show it when the user expands. You could also dynamically grab the required data when a user clicks on a row, but then you'd need to show a wait image while you grab the data by ajax (which would be fairly easy with mvc)
2.) How do I make the grid expandable to show additional data?
Plenty of expandable html grid results on the net :) Depend show you want to hide/show it.
3.) How do I model my sql, do I create one query for both and then selectively
This depends on the approach in 1 above. If you use ajax, you'd be returning one row at a time. In the other scenario you can have two queries you then merge into two view models or you join query A results with query b if theres a 1-1 mapping, assuming there isn't though so make two calls. Again, this is up to you. Do you want to pass all that data up front if the user will only expand two rows? not likely, in that case I like the ajax approach.

Genexus: Sort a Top10 list (grid) using a variable

I have the following issue: I'm generating a Top10 list of items, based on how many times each item has been sold. I can calculate that number and store it in a variable correctly, but when I try to sort the grid by that variable programatically, Genexus won't let me (ofcourse I can click on that row and it'll get sorted correctly, but that's not what I want).
As far as I've read, grids can't be sorted using variables for some reason, is there a workaround for this?
You should use a Data Provider to load a SDT with the Top10 list of items, sorted by solded items. Then show the output SDT in a grid.
You should try to find a way to load them in the proper order.
If that is not posible, create an SDT Collection with the items and use the method sort.
After that, change the grid to a non-base table grid and use the load event to load the content of the collection.

Edit ASP.NET Dynamic Data visibleTables Display Names?

I've figured out how to use metadata to define the displaynames for table data I want to rename - but I haven't figured out how to do this to the tables themselves - so that when the initial dynamic data menu comes up the menu options are friendly rather than the actual table names. Any suggestions?
See the TableNameAttribute. It takes effect when you reference MetaTable.DisplayName. The attribute can be applied either to the specific table class, or its associated MetadataType class.

Resources