Created
March 2, 2014 06:50
Revisions
-
philbritton created this gist
Mar 2, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,216 @@ /* Styles for the query builder container: query builder + results. */ #queryBuilderContainer { position: relative; font-family: "Segoe UI", Helvetica, Verdana; width: auto; } #queryBuilderContainer * { margin: 0; padding: 0; box-sizing: border-box; } #queryBuilderContainer #queryBusy { background: #606060 url(images/msls-loader-light.gif) no-repeat center center; cursor: wait; display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 5000; -moz-opacity: .35; opacity: .35; } #queryBuilderContainer h1 { font-weight: normal; font-size: 2em; line-height: 1em; padding-bottom: 10px; } #queryBuilderContainer button { border: 0; } #queryBuilderContainer .buttonQuery { cursor: pointer; margin-top: 15px; padding: 10px; width: 80px; height: 35px; } #queryBuilderContainer #submitQuery { background: #29ABE0; color: #FFFFFF; margin-right: 15px; } #queryBuilderContainer #clearQuery { color: #000000; background-color: #E6E6E6; } #queryBuilderContainer .wrongInput { background-color: #f8a4a4; } #queryBuilderContainer .error { color: #ff0000; } #queryBuilderContainer .navigationDropdown { background-color: #d0ebfa; } /* Styles for the query builder. */ #queryBuilder { margin-bottom: 20px; } #queryBuilder .addCondition, #queryBuilder .removeCondition { cursor: pointer; width: 20px; color: transparent; height: 20px; margin: 7px 3px 3px 9px; padding: 0; } #queryBuilder .addCondition { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA7CAAAOwgEVKEqAAAAAB3RJTUUH3QsJATErA49PDwAAAgBJREFUOMut1T1IVWEYB/DfPfdKXxTRkFFD0KUhDUIotEYHl0KkoKlF+qBIoqGGloZoq6EPpaAiCGmIDDVaa4sgSYSyaIiiEEkSK4REr7flOXA63NsH9MCBw/s+z//5/r+Fjo4ONWQrdmMvmlGN8wJe4QEe4WXesJADXImTOI05PMczTMf9GrRhB5bgAi7hewpQyoCtQy/24V4oj6gt28PpOWxDDyazgKvRhz04hluYV19GcABPcDlKcRAzKWBP1Oswbvo7mcd1LOAGRnG+WC6Xm3EH93E204BUVmEX1mMqALIyhs04hKEEneHtIio1ItmCAdzG2hr3lbCdR2eCLjyNkOulVox6/6ijMxoYXQmaYjSyqa7AJjRGqgUk2IgN8TVk9KuB0VQKxS85j+3RnG9YHg6WRepVfEI33mZsppEkoVDxn6QUgI2588fYidnYiruRxX5MhM7nnM0aLJYwjtaoU1rHWbyL/4k4X8SHGkDpjrdhPMFgzFlLnSwaoiQLWFpHpyUwBhMMh9GpGI+8vI797q4TXTFsGzBcLJfLU9HpE/iIFzmDObyPu4UagEdwJohiIN3l3gi7Lxr1J3JIS3E0yGEAV0VkMIPjeIhr6A+K8hv66seV4IAefM3z4WTUaSy4rj1HsJXY5dYYpWKQyS8EW/iHJ6AaGaVPwBDe5A1/AgojgwuRXC6BAAAAAElFTkSuQmCC) no-repeat; } #queryBuilder .removeCondition { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA7CAAAOwgEVKEqAAAAAB3RJTUUH3QsJATEJ1u8O6wAAAbBJREFUOMut1V+LTVEYBvDf2bOPUmp8h9MwF0oSytVEdkfNRLmYK00ulFwpJWNEHYYo5gO40rggKRkX/tYkSaNc00l8hCEiMw43767V7nTmODy1L9ba63ne9b7rfdaqFUWhC0ZxEOPYhRy/sYolPMR9vKsShxqNRjpeh1O4hf34gdsxfoZP2IJJHIkgS/hVCuSJ2EbMx66e4yqe6I4iAl/CbhzGMmSxoI6bIXYOzR5i4l8z1o4Ht56mfBrHcR4X0LE2OngRaR/Dd7ysFUUxgrdRiyZW/B3qeITt2JbhEDZgdgAxwZnFMCYzTKCNRYNjMTQmcuzAjUrdhrE+6tMNGb7gW1LPpziaRw3aFcJFHOhxOEOYw/Vkro162Tar/hPyENtUmT8bhV4r5RQjWMmTdsmSFD/H1y8y7MObDAuhPvYPmY6FxkKGe/iKmdI+AzT2TGR0J4vTuYw9mB5AcDq4V/Cx9PJrbA1PdvCqDz/nsbMWHuAEOllin6m4OFvhzaKHWBFrWsGZKm2b3ofL4euTEfkx3sfd2E5aYy82R9ucwTX8LEVqfTwBO5PA6RNwFx+qxD9+2m672NnhxQAAAABJRU5ErkJggg==) no-repeat; } #queryBuilder #queryUrl { font-size: 80%; } #queryBuilderForm select { padding: 2px; margin: 5px; } #queryBuilderForm input { padding: 3px; margin: 5px; width: inherit; } #queryBuilderForm input[type=text] { min-width: 250px; } #queryBuilder label { display: inline-block; padding-top: 4px; min-width: 100px; /* Without this one FF and Chrome wil put the label on top of the buttons and they will make them not clickable. */ z-index: -1; } #queryBuilderForm #orderByFiltersList, #queryBuilderForm #selectFiltersList, #queryBuilderForm #expandFiltersList { display: none; } #queryBuilderForm #orderByConditions.listVisible span, #queryBuilderForm #selectConditions.listVisible span, #queryBuilderForm #expandConditions.listVisible span { overflow-y: auto; overflow-x: hidden; max-height: 200px; width: auto; display: inline-block; padding-bottom: 10px; padding-right: 10px; } #queryBuilderForm .listVisible button { vertical-align: top; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA7CAAAOwgEVKEqAAAAAB3RJTUUH3QsJATEJ1u8O6wAAAbBJREFUOMut1V+LTVEYBvDf2bOPUmp8h9MwF0oSytVEdkfNRLmYK00ulFwpJWNEHYYo5gO40rggKRkX/tYkSaNc00l8hCEiMw43767V7nTmODy1L9ba63ne9b7rfdaqFUWhC0ZxEOPYhRy/sYolPMR9vKsShxqNRjpeh1O4hf34gdsxfoZP2IJJHIkgS/hVCuSJ2EbMx66e4yqe6I4iAl/CbhzGMmSxoI6bIXYOzR5i4l8z1o4Ht56mfBrHcR4X0LE2OngRaR/Dd7ysFUUxgrdRiyZW/B3qeITt2JbhEDZgdgAxwZnFMCYzTKCNRYNjMTQmcuzAjUrdhrE+6tMNGb7gW1LPpziaRw3aFcJFHOhxOEOYw/Vkro162Tar/hPyENtUmT8bhV4r5RQjWMmTdsmSFD/H1y8y7MObDAuhPvYPmY6FxkKGe/iKmdI+AzT2TGR0J4vTuYw9mB5AcDq4V/Cx9PJrbA1PdvCqDz/nsbMWHuAEOllin6m4OFvhzaKHWBFrWsGZKm2b3ofL4euTEfkx3sfd2E5aYy82R9ucwTX8LEVqfTwBO5PA6RNwFx+qxD9+2m672NnhxQAAAABJRU5ErkJggg==) no-repeat; } #queryBuilderForm .filterList > label { display: block; margin-right: 20px; white-space: nowrap; } #queryBuilderForm .filterContainer { padding-left: 68px; position: relative; } #queryBuilderForm .filterLabel { display: inline-block; float: left; position: absolute; left: 0; vertical-align: top; } /* Styles for the results. */ #results { margin-top: 10px; } #results table.defaultResultsFormatting { border-collapse: collapse; } #results table.defaultResultsFormatting tbody tr:not(.expandedChild):hover { background-color: #DAECEF; } #results table.defaultResultsFormatting th { background: #E6E6E6; color: #000000; } #results table.defaultResultsFormatting th, #results table.defaultResultsFormatting td { border: 0; padding: 2px 3px; text-align: left; } #results td table.defaultResultsFormatting th, #results td table.defaultResultsFormatting td { padding: 1px 2px; } #results table.defaultResultsFormatting tr:not(.expandedChild) > td { max-width: 300px; max-height: 50px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } #results table.defaultResultsFormatting .expandedChild > td { padding: 0 0 0 50px; position: relative; min-height: 30px; } #results table.defaultResultsFormatting .expandedChild > td table { margin-bottom: 8px; } #results .expandChild { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA7CAAAOwgEVKEqAAAAAB3RJTUUH3QsJATIB8xnVGgAAADZJREFUGNONzLENACAMxECzwY+Y/ZcwBSUixPXJ0FRVAk7AQepqgL/DjR7ACXAC/AOQJC1I4gauvkEq2U4JQwAAAABJRU5ErkJggg==) no-repeat; display: inline-block; width: 12px; height: 14px; } #results .expandChild.collapsed { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAMCAYAAACulacQAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA7CAAAOwgEVKEqAAAAAB3RJTUUH3QsJATIPFKH4HQAAAGpJREFUGNN9kNENwCAIRA/DQG6gIziKTiIruJETlX6ZgrW9P/JeDgJyzlprVVUlbOGUEkopaK1dAJzAABBjXLOKCDn4JbCt2QXej7BCwE9ecM6JMQZ67yGcgIgQET21FrhaW+V2rPedDroBb3kzlWXCo2UAAAAASUVORK5CYII=) no-repeat; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,69 @@ <!DOCTYPE html> <html> <meta http-equiv="X-UA-Compatible" content="IE=10" /> <title>OData Query Builder</title> <style type="text/css"> body { font-family: "Segoe UI", Helvetica, Verdana; padding: 20px; } #results { white-space: pre; } </style> <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.0.min.js"></script> <!-- The following two libraries are included in the JavaScript and CSS section of the jsbin. <script src="Scripts/datajs-1.1.1.min.js"></script> <script src="Scripts/odata-query-builder.js"></script> <link type="text/css" href="Content/odata-query-builder.css" rel="stylesheet" />--> <script> // Document ready event handler. $(document).ready(function () { var createdQueryBuilder = new OData.explorer.DataExplorer( { // An array containing the different endpoints. endpoints: [ { name: 'OData', url: 'http://dacgrouptools.cloudapp.net:8181/mscrmconnector/odata.rsc?%40authtoken=1b1A2c1p8E6y3r5F2r0x&%24callback=parseFunction&%24format=json', provider: function () { return ODataMetadata; } } ], encodeUrlComponents: true, hideOrderbyFilters: true, hideColumnFilters: true, hideExpandFilters: true, // Overwrite the default onUrlChange callback. onUrlChange: function (url) { console.log(url); }, // Overwrite the default onSubmit callback. onSubmit: function (url) { // If nothing or false is returned we will // not execute any query to fetch the data for you. return url; }, // Overwrite the default onResults callback. onResults: function (data) { // If nothing or false is returned we will // not display the results in the #reulst container for you. return (JSON.stringify(data, null, 4)); }, // Overwrite the default onError callback. onError: function (error, url) { console.log(url + '\t' + JSON.stringify(error)); } }); }); </script> <body> <h1>OData Query Builder</h1> <p>press "RUN WITH JS"</p> <div id="queryBuilderContainer"> </div> </body> </html>