Jump to content

zilav

uniGUI Subscriber
  • Posts

    573
  • Joined

  • Last visited

  • Days Won

    44

Posts posted by zilav

  1. No fixed format as all of them just make XHR to this url. Some of them add additional parameters to url, another pass them in request's body (as json, xml, etc). And some even leave sync methods on developer, you just need to provide a function which will accept some params and return data in array, or plain json.

    So format doesn't matter. I just need an event called by manual XHR from client browser that can return raw data (header and body). And event should be unique for every session, thats why I proposed it's url to be generated by unigui.

     

    Typical scenario - virtual scrolling grid with dynamically loaded data. In this demo it pulls json from this url (adding paging info to url directly)

     

    var url = "http://services.digg.com/search/stories?query=" + searchstr + "&offset=" + (fromPage * PAGESIZE) + "&count=" + (((toPage - fromPage) * PAGESIZE) + PAGESIZE) + "&appkey=http://slickgrid.googlecode.com&tyape=javascript";
    

    In my app I'll be pulling data from DB, so for example this base url "http://services.digg.com/search/stories?query=" should be generated by unigui, and I'll add my info to it.

    But like I said some libs like to provide request param in request's body, so this method should be supported too.

     

    p.s. Implementing this feature will truly open a vast possibilities of integrating hundreds of modern js libraries in unigui. I wouldn't even need ExtJS4 with it as everything will be possible to be made with 3d party tools inside UniHTMLFrame. :D

  2. As you can see there is not much to see here. The frmPlayerEdit is an editing form with its own instance of the table being edited. The table is refreshed after the change and does get the updated information as the VCL version works.

    There is actually much to see here. Your table is refreshed before the change, not after, because ShowModal doesn't block execution in unigui.

    You must use callback events to execute some code after window is closed.

    But you don't need manual refresh here at all:

    1. Your modal Form should have UniDbEdit components attached to some Form.DataSource for editing and UniButton(s) with some ModalResult. Assign your dataset to Form.DataSource before calling ShowModal.

    2. Call dataset.Edit or dataset.Insert before Form.ShowModal

    3. Call Form.ShowModal

    3. In Form.OnClose event check for ModalResult and either do dataset.Post or dataset.Cancel, unidbgrid will be updated automatically, no need to call a manual refresh.

     

    You need this extra datasource on modal form if your dataset is located on another form. If your dataset/datasource is in datamodule, you can attach uniedits directly without the need of extra datasource and passing of dataset.

  3. We already have a SendFile and ajaxRequest for additional data communication with server, but sometimes that's not enough. There are many js libraries out there that dynamically require some data (usually json), for example virtual scrolling lists and grids. The only way to do it now is to save a json file in LocalCache and provide url link to it.

    What I need is some sort of event in MainModule, which is called when a request is made for some endpoint url. It needs to be able to pass url parameters (like onajaxrequest) and request's body as string (some js libs like to pass parameters via json and not in url), and sends back mime type (or even better custom html headers via TStrings) and data from TStream.

    The endpoint url can be generated for each session with some uniGui method (in case it's implementation changes in future unigui versions), for example I call UniSession.GetEndpointURL, then add my additional url params to it, and give it to js library for it's ajax calls. If current session is active it fires event in MainModule, if session expires then just return empty response.

  4. MSSQL, IIS, ordinary TADOConnection plus Ehlib's TADODataDriver + TMemTable = perfect combo for business CRUD applications. I keep all data handling logic on sql server (stored procedures and functions). My apps don't have a single select, update, insert or delete statements. Using only parametrized calls to stored procs makes you immune to SQL injection attacks.

  5. Javascript is asynchronous, so every time OnKeyDown event is called, browser doesn't actually add to unimemo and clear uniedit, it just generates ajax call to server. On server side you specify your actions, unigui converts them to javascript and sends it back to browser in response. And only when this generated javascript is executed, the changes happen.

    Each ajax call doesn't wait for previous one to complete, so if user presses Enter quickly many times, severals ajax requests will be generated to server, each containing your current text in uniedit. Until one of them is completed and uniedit is cleared, all those requests will do the same thing - add the same text to unimemo. Thats why we need masks to prevent user from generating subsequent ajax calls until application state changes.

    To make changes immediatly you'll need to write some processing logic on client side in javascript. In your case, for example, you can intercept onkeydown javascript event of uniedit and clear it from there, not on server. Or even add that text to memo and clear uniedit entirely client-side, optionally calling ajaxRequest() to inform server about changes.

  6. I think TinyMCE is just a richtext editor that uses basic html tags for formatting. It is not a complete html web page editor. Your example uses custom styles, doctype, body, head, meta and other tags that don't do any formatting.

    Your example also contains double quotes used in enclosing string for setContent("") method of TinyMCE, you should encode them or replace with single quote. The same applies to \r\n\ too.

     

    p.s. If you already have html text inside some Memo, you can try to copy it directly on client

     

    UniSession.AddJS('tinyMCE.get("ed1").setContent(MainForm.UniMemo1.value)');

  7. Placeholder property is an HTML5 thing, so you'll need some custom scripting to make it work in IE. For example placeholder.js

    My advise - just forget IE. 1-2 years from now IE will be autoupdated almost everywhere (unless on XP) to support HTML5. Even if it is not working now, placeholder is not an essential feature you can't live without. It's nice, but not "a must".

  8. Sencha controls has a PlaceHolder property that allow me set a default text what a edit is empty.

    PlaceHolder and default text are different things. I checked uniedit in FireBug but couldn't find PlaceHolder property. Oh well, doesn't matter really, we have a good old DOM...

     

    function OnAfterrender(sender)
    {
     if ('placeholder' in sender.el.dom) sender.el.dom.placeholder = 'test';
    }

    Add to UniEdit's ClientEvents.ExtEvents

  9. I think applets have 2-3 more years before they'll be abandoned in browsers (until some miracle happens of course, like Oracle becoming the best friends with Google/Mozilla/Microsoft). But it is not the real problem. You must have java installed for this to work. Your users must install java. So if you have a several hundreds of users, all of them must install java.

    I think that the web apps should work with a bare browser without any additional plugins. If you are forcing your customers to install additional components for you web app to work correctly, it would be better just to write a normal desktop app.

    You force them to install something, so why not just force them to install a desktop application with a much larger capabilities than any web app can ever provide.

    The true beauty of web applications is just that they work in browser, which is built-in in any OS.

  10. Check this: code.google.com/p/jzebra/

    I strongly advise againt it, java applets technology is dead. Noone is supporting it except Oracle, buy they don't have a word in modern web development, and sooner or later all browsers will stop working with applets. Don't trap yourself in dead technologies.

  11. Есть проект который крутиться на серваке, к нему обращаются пользователи снаружи, задача по нажатию на кнопку формировать отчет и открывать у пользователя в браузере, если есть плагин откроет страницу, нет - скачает и сохранит. Проблема в том что нельзя использовать ShellApi unit, потому что когда я вызываю гиперсылку, то отчет открывается на серваке а не на клиенте, что логично, Подскажите варианты запуска гиперссылки по кнопке. Спасибо.

    Используй CSS чтобы превратить ссылку в кнопку. Примеров полно, например http://webdesignerwall.com/tutorials/css3-gradient-buttons. Добавь параметр target=_blank в тег <a>, чтобы ссылка открывалась в новой вкладке/окне.

    Это самый простой вариант.

  12. Hi Farshad!

     

    I have a simple feature request. I want to optimize all js and css files and combine them in a single files to speed up application loading. For this I need to be able to completely define the content of <head></head> tag.

    Now UniGUI only allows to add files, css and set meta's. Can you please add ServerModule.CustomHead property of TStrings, and if it is not empty don't internally generate any <head> and just put that property's content there?

  13. It is possible, but pointless. That plugin counts you idle when you don't push keyboard or scroll with mouse, but for UniGUI you are idle when there are no requests coming from client browser. That means you can type some long text in memo or scroll dbgrid with mouse and still be idle from UniGUI's point of view, but not idle for jquery.

    I usually set very high timeout in my apps like 1-2 hours, thats more than enough.

    I admit that such functionality could be useful, but it would be better to have it as a built-in UniGUI feature and not some js/jquery hack.

×
×
  • Create New...