Archive for the 'MochiKit' Category

Graph view for ModelDesigner

Sunday, December 11th, 2005

ModelDesigner has been well recieved, but several people missed a ‘graph view’, someone in the list pointed me to Ondra Zara amazing ‘WWW SQL Designer’.
Keeping in touch with the “don’t reinvent the wheel’ mantra, I have implemented a graph view for ModelDesigner borrowing much of his code to do the visualization part.
Give it a […]

Introducing ModelDesigner

Sunday, November 27th, 2005

TurboGears 0.9 will ship with at webbased administration app called ToolBox.
Among the tools available right now there is a model browser (CatWalk), a webbased Python interpreter, a Widget browser and now a model designer.
The ModelDesigner is a code generation tool for SQLObject models.
Watch a short introductory screencast here.
Or play with an online demo.
I’m have still […]

Coding conventions

Monday, November 7th, 2005

Now that CatWalk is part of TurboGears I have some cleanup to do, because allMyMethodNames should now be underscored to match TG’s coding style.
That’s all right with me, but some places it looks a bit weird, CatWalk’s use SQLObject and MochiKit extensible and both use camelCases.
Talking about weird, CatWalk is made of umgefärt 900 […]

Grid widget on a JSON diet

Wednesday, November 2nd, 2005

www.checkandshareCatWalk’s grids are dynamically build using MochiKit terrific Stan syntax.
They accept a data structure (JSON) and return a grid element you can add to your page or manipulate further using the DOM.
This is just javascript, no server side magic. You can use it with or without CatWalk.
Though TurboGears json output (tg_format=json) makes it really easy […]

Configuring which columns you want in your grid views

Tuesday, November 1st, 2005

If you have objects with a lot of fields and you don’t want to clutter your grid views with all the extra information which better fits your detail view, then this feature is for you.
Grid view in CatWalk comes now with a small dingy (top right), like in mozilla grids. If you mouse over […]

Eval and IE

Saturday, October 22nd, 2005

I think I wasn’t clear about my last post regarding IE and eval on dynamically generated input fields.
Here can you see what I meant:

<html>
  <head>
    <title>eval test</title>
    <script src="/tg_js/MochiKit.js"></script>
    <script>
      function addInputToForm()
      {
        var newField = createDOM('INPUT',
                                  {'type':'text',
                                   'name':'youCantEvalMeInIE',
                                   'value':'hello'
                                  }
                                )
        replaceChildNodes('formContent',newField);
      }
      function evalNewField()
      {
        //works on firefox and safari, by not IE
        var f = eval('document.myform.youCantEvalMeInIE');
        alert(f.value);
      }
      function lookUpField()
      {
         //works on firefox, safari and iE
        for(var i=0;i<document.myform.elements.length;i++)
        {
          if(document.myform.elements[i].name=='youCantEvalMeInIE')
          {
            alert(document.myform.elements[i].value);
          }
        }
      }
    </script>
  </head>
  <body bgcolor="#FFFFFF">
    <a href="javascript:addInputToForm()">Add field</a>
    <form name="myform">
      <div […]

JavaScript & IE

Friday, October 21st, 2005

While using MochiKit to render CatWalk’s views I stumble upon two quirks.
First, when you are generating tables dynamically with the DOM you have to add your rows to a tbody element.
I couldn’t get IE to display my table without it. This is something I discovered after heavy googling and a single malt.
It should be table->tbody->tr->td-> […]