Comments (6)
Wouldn't be useful to have a possibility to set the verb during the grid creating ?
The use of POST instead of GET would be useful.
That's not compliant with the REST use of the verbs, I know, but useful nevertheless ;)
from w2ui.
The GET, PUT, POST, DELETE is a new feature since 1.1 release. I am not very convinced about them, but it is indeed needed to be fully REST compliant. I do agree with you that GET does not look good for grid because it sends lots of data to the server in URL. I wanted POST for it too. I have agreed to do this because of suggestions from other developers. However, I did have already one problem with it. Some hosting providers deny by default any methods besides GET and POST. And it requiers additional effort to request it. I think the library should give developer an option to do fully rest or not.
So, I have been thinking of creating a global setting available for developer to change to use full REST complient interface or not. If not, then it will be like it was before. Pretty much any request that passes variables will go through POST, otherwise GET. You comments are welcome.
from w2ui.
I believe the better way is to give the user the option to make server call rather than grid making it.This gives user freedom to choose Http method, and does not force server to provide specific api for grid. Right now 'request' method assembles the param object and makes server call. Although there is a option to stop server call, the user needs to do what is done in 'complete' method.
from w2ui.
There are 2 events: onRequest and onLoad. First one is fired before any server call is made and this event handler will receive all assembled parameters that would be send to the server. The developer can change this list of parameters and the modified list will be sent. Or the developer can stop event flow and do the call on his own. If grid makes the call, then onLoad method will be fired when server responds but before it processes server results. The developer also can stop the event and process manually.
Please help me understand how this can be improved. To my mind, the developer has a way to do both (1) modify before and after the server call or (2) completely replace server call with his/her logic.
from w2ui.
The default behavior is absolutely useful if you have freedom to built server side REST api which accepts POST method and understands postData map that grid is sending.
We have a server side api which accepts only GET requests and parameter names are different. For example, in postdata map, search pramaters is array. In our case we pass them as query params. Say field names orderId, the query prams will be orderId=2&order_op=LIKE.
To satisfy my server currently I have to do the following.
- Stop the call by listening by handling before.
- Convert the postdata map to something my server understands.
- Receive response from server.
From here I need to do what 'complete' function in ajax call is doing in 'request' method. The function has critical features.
4. Hide status.
5. Fire events.
6. Show error message in popup.
7. etc etc
You can move steps 4 to 7 to separate function and make it available for calling. This way someone else need not repeat this steps.
You can look at the 'fnServerData'(http://datatables.net/usage/callbacks). What it does is,
- Whenever data is needed make call to 'fnServerData' with necessary params(similar to postdata) for server and a callback function.
- User will make call to the server.
- Once data is received, it is converted to the format that datatables expect and invoke the callback function it is passed.
With this approach, you can see that datatables need not even care about where the data is coming from(server or local). All it is doing is asking for data when it is needed.
Don't get me wrong w2grid has great functionality. Like any other component it is not possible to satisfy every user. Fortunately in this case, it fits for us with a slight modification. Right now I am trying to re-factor 'request' to fit our needs. If I am able to do it generically(I am a Java guy :) ), I will open pull request.
from w2ui.
I have added a setting
w2utils.settings.RESTfull = true
If it is false, which is default now, it will submit POST and in some cases GET. If it is true, it will be fully complient with REST. It will submit GET, POST, PUT, DELETE words when necessary.
from w2ui.
Related Issues (20)
- square button shape HOT 1
- Popup window from another popup window with forms HOT 1
- Экранная форма не масштабируется на весь экран при открытие окна на весь экран HOT 2
- Можно ли вывести таблицу в виде иерархии если иерархические данные организованы в виде таблицы HOT 1
- Как исправить ошибку 404 (NOT FOUND) при выполнении примера Popup Conten From File HOT 1
- W2ui v2.0 grid not support select? HOT 1
- ERROR: field type "custom" is not supported HOT 4
- w2grid: Set position of advanced search (when toolbarSearch is false and triggering elsewhere?) HOT 4
- Inline Editing -> Record editable: false has no effect
- ERROR: field type "custom" is not supported HOT 1
- w2sidebar goFlat with node do not have icon HOT 1
- custom render of grid checkbox bug HOT 4
- w2Popup - Multiple Custom Buttons
- w2grid 2.0 have freezing column have row align not correct HOT 2
- w2grid column's editable with type='select' work ok in v1.5 but NOT work in v2.0 HOT 1
- how to use jquery with w2ui HOT 1
- a regret related to object w2field('combo') in w2ui 2.0.x (nightly) (6/27/2024, 6:00:52 PM)
- Your documentation is messy, some with es6 and some with jquery
- V2.0 w2field does not support validate
- v2.0 grid toolbar toolbarAdd,toolbarEdit,toolbarSave etc. tooltips don't support w2utils.locale HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from w2ui.