Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My jtable extensions as separated files #73

Closed
wants to merge 15 commits into from
Closed

My jtable extensions as separated files #73

wants to merge 15 commits into from

Conversation

gbisheimer
Copy link
Contributor

Also added spanish localization script.

*Sorting: add support for sorting multiple columns
*Footer: adds a footer row that allows to totalize columns
*MasterchildEx: Builds master/child relations without the need of using
'display' prop on field. User control child table display by adding a
'childTable' prop to field as:

childTable: function( parentRecord ) {
return{
title: parentRecord.name + ' - Details',
sorting: true,
defaultSorting: 'date DESC',
actions: {
listAction: '/list_purchase_details&id_purchase=' + parentRecord.id
},
fields: {
date: {
title: 'Date'
},
total: {
title: 'Total'
}
}
}
}
@hikalkan
Copy link
Member

Thank you so much for your contributions. I'll merge it after my tests.

@hikalkan
Copy link
Member

I'm working on codeproject article (http://www.codeproject.com/Articles/277576/AJAX-based-CRUD-tables-using-ASP-NET-MVC-3-and-jTa) to update. I'll take a few days. I'll check and merge it (probably) this weekend. Since this is my first pull request, i'm a bit novice :) Thanks.

@gbisheimer
Copy link
Contributor Author

Great article and lots of useful information at bottom discussions!

I'm new at lesscss. Which compiller do you recommend? I tried Crunch
compiller and it outputs a different .css than the one you provided in
GitHUB package. There is a problem with the background images path's (omits
the heading ../../ when using importing a .less file from another
directory).
Also, which application should I use to merge .js files from the dev
folder? I've noticed the .txt files but don't know how to merge them
automatically.

Cheers!

2013/1/15 hikalkan notifications@github.com

I'm working on codeproject article (
http://www.codeproject.com/Articles/277576/AJAX-based-CRUD-tables-using-ASP-NET-MVC-3-and-jTa)
to update. I'll take a few days. I'll check and merge it (probably) this
weekend. Since this is my first pull request, i'm a bit novice :) Thanks.


Reply to this email directly or view it on GitHubhttps://github.com//pull/73#issuecomment-12286099.

@hikalkan
Copy link
Member

Hi @gbisheimer, I'm using Web Essentials with Visual Studio, it automatically generates CSS when I change the less file. I coded my own application for merging js files from dev folder :) I will share it here (at the moment, I'm at work, I'll share when I go to home).

@hikalkan
Copy link
Member

I added builder to GitHub: https://github.com/hikalkan/jtable/tree/master/dev/build

@hikalkan
Copy link
Member

I reviewed your extensions. Included Spanish localization to v.2.0.1. Other extensions also nice. Thank you so much.

Since this is first contribute to jTable, I must think how to include such contributes in jTable.
Problem is that: An extension/code that is directly included to jTable codebase must be 'general purpose', 'well documented', 'tested' and 'has example usages' as other features of Jtable have in the jTable org.

So, at the moment, I think to create a 'plug-ins area' in jTable.org to include such extensions with it's author's name and documantation. Then I can include it to jTable's core code base if this extension is well documented and found usable by community.

When I open 'plug-ins' page in jTable.org (I'll do it in a very short time), your codes will be the first plug-ins those I want to share with community if it's OK for you?

@gbisheimer
Copy link
Contributor Author

I think it's a great idea to include a plug-ins area.

I will write the documentation for my plug-ins shortly and share it with
you then. I forgot to mention... feel free to modify my code to adapt it
better to jtable, if necessary This is my first contribution to the
community after many years of using community code without giving anything
in return. It was about time...

I tried to maintain your coding standard in the plugins (for example
variable/functions naming convention, code areas) but It would be easy to
review future plugin's code if there are written guidelines for developing
jtable plugins. For example, no plugin should alter basic jtable
functionality in a way that makes other plugins incompatible. Plugin's
author should also indicate core jtable version on which it was tested.

I've written a new plugin that I will share soon, that fixes the problem I
was having with option fields because of the cache functionality, and also
the problem with option sorting. In order to do this I needed to change
returned options from an object to an array in
function _getOptionsWithCaching and other associated functions to make them
compatible with this modification. If another plugin needs to override this
functions, this will prevent my plugin to work properly. I'm not sure how
to fix this. May be you can give me some ideas to overcome this problem.

Thank you for including my code on jtable. Looking forward to see that
plug-in area available.

Cheers!

@hikalkan
Copy link
Member

Thank you so much for your contributions. Your codes really fallows same style of core jTable code. Also, they are coded very vell. So, it was not about that to not directly add them to jTable core extensions.

I'll work to prepare such as plugins page.

Also, options caching and retriving is one of the first area that I will work on. I think to allow to define a function for options, such as:

options: function(data){
    //can return url, object or array dynamically. Can get the record with data.record
}

I will cache only if returning URL is returned before. Also user can clear cache with data.clearCache();

I think this will solve many problems.

Filters extension is far from finished, but its a starting point. Also
included CSS changes for these plugins to work. As Reload and Filters
adds a command button on table title, I needed to float some things to
make it possible to stack buttons to the right of title bar.
@gbisheimer
Copy link
Contributor Author

I'll eventually add usage information for my plugins, but for now I'll write something about my masterchild.ex extension.
It's intended to be an easier way to create JTable child tables.

To instantiate a child table, just add a new field to jtable fields object as follows:

``` javascript`
details: {
title: '', // column title
width: '1%',
edit: false, // Don't want it to be shown on edit or create dialog
create: false,
listClass: 'jtable-command-column', // Adds column style
icon: { // field icon definition
src: 'images/list_metro.png', // image source
title: 'Shows row details', // image title
iconClass: 'hover_img' // optional icon class
},
childTable: function( parentRecord ) { // Child table definition function. Returns a JTable options object
return{
title: parentRecord.name + ' - Details', // Parent data dependent child table title
sorting: true,
defaultSorting: 'date DESC',
actions: {
listAction: 'php/data.php?query=query_details&id=' + parentRecord.id // Parent data dependent list action
},
fields: {
date: {
title: 'Date'
},
phone: {
title: 'Phone number'
}
}
}
}
}

@hikalkan
Copy link
Member

Hi @gbisheimer, I am investigating your plug-ins. First one is multiple sorting. I examined code, It's OK. I want to merge it into jTable core sorting, instead of seperated extension. If it's OK for you, please change dev/jquery.jtable.sorting.js file according to your extension and send a merge request, I'll accept it.
Some notes:

  • Use _lastSorting variable as your array, so no need to _aSorting.
  • Directly change _makeColumnSortable, _sortTableByColumn and _addSortingInfoToUrl methods with yours.
  • Add a general option: multipleSorting that's value is false as default.

I'm waiting for your pull request. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants