Closed adarshpastakia closed 7 years ago
I would say the total should return total records. Also it will be nice that serverOption could include filterOption and sortOption. Smth like:
filterOptions:[
{ field:'aField',type:'aType',value:'aValue',oper:'is'}
]
sortOptions:{'field':'aField',dir:'asc'}
Another thing I notice missing from serverOptions is the offset. For instance, if we want to implement virtual scroll, we should know from which row to fetch new data...
btw, do you need any help whith this? Maybe writing docs or examples?
Would you consider implementing a DataSource feature? I'm thinking that all the components that needs data (combo, list, grid, etc) should delegate the data to a data source. This way it will be a developer choice how the data will be fetched for a component (server or local) The dataSource would implement functions like fetchData, filterData, sortData, etc. Those methods will receive parameters and will return the data based on developer implementations.
Of course, the dataSource would be optional, allowing developer to pass as data a simple array, if so desired.
Also, if the data is fetched from server maybe the response should include a summaryRow based on calculation made on server...
These features exists in some libraries, and missing in others. I find myself struggling on which library to use and more than often I felt that I should write my own. Unfortunately I'm working as a programmer with full time job and i lack the time do do it.
So far your library meets almost all the requirements of a complex business application so it will be nice to see it become more powerful.
All the best.
@ratones You are right the DataSource concept would be a better solution, will try and write up a draft of whats required
actually i too have used various frameworks working on back office applications for my company, eventually i started this firstly to learn aurelia and then got to a point that i start building my projects on it. so far have made quite a few blunders in the first two iterations, so this time around I'm hoping to stick with it and try and improve on whats been done.
Also since I'm using this framework on my projects thats when i can really test certain aspects of it and keep releasing fixes quite often, need to get to a stage where i don't do that often.
So any help will be really appreciated, between working on my projects and updating the framework I'm actually struggling to write up the wiki for it
Wrote up a simple draft for DataSource, will try an expand on it further. #21
Great news! I'm actually start learning Aurelia few days ago, coming from Backbone, then Knockout. I had a few takes on React, not really what I wanted... Never tried Angular, don't know why, never felt attracted to it.
As UI library I used w2ui, which is OK as long as you don't use anything else for data modelling. But since in general business apps require extensive use of data, this is not a best approach, I find myself fighting with it sometimes.
Prior of finding your library I actually started writing a version of w2ui compatible with Aurelia. Your is more appealing ;)
So, any guides on writing the wiki? I really would love to help, since I used a lot of community work, but never really give back... :(
@ratones to tell you the truth documentation is not my strong point, so been struggling with it.
for the moment im just trying to write up the properties/attributes for each component with a sample markup for it, you can check the wiki thats available right now
OK. I'll follow your progress and try to update the wiki with some info and examples. Feel free to intervene any time!
Have you considered implementing inline editing?
If so, do you mind if I work on this feature?
What I have in mind:
Add a rowState
property
Add a config
property for column
config: {
editable:{
type:string,
options: any
}
}
If column is editable change rowState
on dblClick
or onClick
of an edit button.
Add a row template for rowState = editing
with controls according to col.editable.type
and col.editable.options
property.
Figure out how changes will be submitted , either to dataSource, or a callback... We might even do a bulk update, store changes in an array etc... If you have thought about this feature and have a different approach, please let me know. It is a required feature for my projects and would be nice to have it.
@ratones I'm actually in the process of updating the dg layout and add data-source instead of data arrays, for this i have created a branch. also for a project of mine i have a requirement for expandable rows, so am trying to get to a workable layout. but in the meantime you can work on the editable row feature.
@adarshpastakia
Do you think it't possible to delegate the column template rendering to ui-dg-column
element?
At the moment the column provides a slot where the template is injected. I'm not very familiar with Aurelia and I might be totally off track here, but I think it will be easier to implement cell editing directly from column component.
Another question is if we could provide a value-converter
for the column value, instead of the local method getValue()
. This way it will be easier to propagate changes back to the record...
I played a little with row editing an i think it's perfectly doable. I have to admit though that I'm not very comfortable with the framework, i'm still in the learning phase. So if i'm asking silly things, please ignore...
@ratones i had previously tried building the markup from ui-dg-column
itself but it didn't work quite well, also the columns are just placeholders we are using to define the columns in the grid in actuality they have no rendered output. although i would like to try to find a possibility of passing a template to a column.
the column element has two callbacks value
and display
, the value callback is essentially for calculated columns where the column value is calculated on the fly and do not exist in the data record and the returned value is passed through the column formatting, the display on the other hand is to return a formatted value to be displayed without any further formatting. both the callbacks are passed the value
and record
so you could update the record during the callback if need be, although i don't see why you would want to update a column' value.
as for value-converters
the columns already provide the basic formatting options date
time
number
currency
they have default formats but you could pass a custom format in the format
property, but if you need a custom value-converter you could use the display callback.
it'll be very helpful if the DataSource will support OData standard out of the box (or at least an easy way to tune it to OData). It can be a game changer, OData is really easy to create and consume and a lot of services are moving toward this standard.
the parts that are not compatible right now are:
1) order/filter on multiple columns (with order between them) 2) skip & top for paging (instead of loadPage(n) as suggested here) more advance features would be the aggregations, drill downs etc.
can I hep in any way? to make that happen?
@avrahamcool any help would be much appreciated.
@adarshpastakia Unfortunately I have been very busy lately and had to focus on a work project. v4.0.0 looks very promising. Do you think is possible to have a distinct container for subdata rows? I'm thinking of a scrolled container, possible virtual repeat with a callback to fetch more data and also a summary row. Basically what I would like to achieve is row grouping with summary. If you want, I can provide an api for testing remote datasource. I have a domain with php and mysql and I can write a rest service to provide data for testing...
@ratones i too was caught up with work stuff, however i did try to work on the data-model which didn't go too well, main problem i found when using the store is that once you update a value the summary value is not recalculated, struggling to find a way of observing changes to the data-model in the store.
as for the container in the row, there are two ways to go either have subdata records within the same grid structure or you could pass a compose element for subview
. the only issue here is that the subview datagrid will have to have a fixed height to make it independently scrollable
<ui-datagrid subview.bind='subview'>
subview = '<compose view-model="./info" model.bind="record"></compose>'
info.html
<ui-datagrid virtual scroll style="height: 200px">
...
activate(model){
// record will passed in model
}
Moved to #69
Added options for making server-side request from datagrid.
Will
total
return total pages or total records?